Common problems

Ant & JUnit

Ant and JUnit may be the two most popular development tools used in the world ... yet, there are problems using them together! What a world..

So, if this problem occurs and you'll see:


BUILD FAILED
build.xml:375: Could not create task or type of type: junit.

Ant could not find the task or a class this task relies upon.

...

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath
then you know. The solution is on the bottom of the information. Just put two files together: junit.jar and ant-junit.jar|optional.jar.

PAT's Ant script tries to do this automatically. If your system is "not prepared" then it will kindly do magic and ask for rerun script again.

IDEs

Eclipse

Running simply from "Ant view" doesn't work. Even after my "magic". So, fix it manually:

Eclipse's menu: Run -> External Tools -> Run As.. -> Classpath [tab] -> User Entries -> [Add JARs]
Choose junit.jar from PAT/lib directory. [Apply] changes. [Run] Ant target by your favourite way.
("Window->Show View->Other->Ant")

IntelliJ IDEA

The same problem like with Eclipse :(.
Fix it manually:

Windows -> Ant build window -> Properties -> Additional classpath [tab] -> [Add]
Choose junit.jar.

repository.dir

If something won't work, check if value of `repository.dir' is OK. If you have write permissions to the directory or/and if it's valid directory.

PAT writes information about used directory for its database when starting:


[java] ==RootCreationInterceptor== Pat.Root's class is: World
[java] Directory for Prevayler is: /home/nthx/tmp/pat/P-databases/skeleton-app
[java] Recovering system state...

Set this variable in the Ant's build.properties:


# User adjustable variables
repository.dir=P-databases

Windows and tests

Tests may fail on Windows OS. This is independent of me.
Problem is related to File.delete() method which works properly only after System.gc() is executed.
So I do System.gc() (this is not guaranteed to work at all), and it helped to work at least on Windows ME.


Revision: $Id: problems.gtml 3721 2005-06-09 23:40:24Z nthx $
Generated with GTML