You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Daniel Hoppe <ho...@sitewaerts.de> on 2000/09/14 20:30:08 UTC

Ant Property Madness??

Hi all,

today we upgraded to Ant 1.1. Before we had been using the prerelease for
quite a long time and were very satisfied so far. Today we made an odd
experience. Out init target setting all directories was placed somewhere in
the middle of the file. Before that were targets copying files, after that
targets compiling and zipping up classes. All properties are set in the init
target. With the old version everything was just fine. After the update, Ant
did not seem to parse the properties anymore and interprets them as plain
text. After some playing around with the buildfile, we figured out that
everything works fine if we place all targets using properties after the
init target. Did we miss something obvious? Please find a snippet of the
version not working anymore below.

Kind Regards

Daniel Hoppe

------>

<!-- CopyTargets -->
...

<target name="copy_wrapper" depends="init,build_wrapper">
	<copyfile src="${base_jars}${wrapper}.jar"
dest="${destination_ejbrelated}${wrapper}.jar"/>
</target>
...

<!-- Init Target -->
<target name="init">
	<property name="base_jars" value="${base_project}jars\"/>
	<property name="base_documentation"
value="P:\${project}\Dokumentation"/>
	<property name="base_webapplication" value="u:\"/>
	<property name="destination_ejbrelated"
value="${base_webapplication}${project}\serverclasses\"/>
</target>
...

<!-- Compile Targets -->
<target name="build_wrapper" depends="init,build_futuna">
		<property name="wrapper.destination_classes"
value="${base_classes}${wrapper}"/>
	
		<mkdir dir="${wrapper.destination_classes}"/>
		<javac srcdir="${base_sources}"
destdir="${wrapper.destination_classes}"
classpath="${base_classpath};${base_jars}${futuna}.jar"
includes="de/sitewaerts/${project}/wrapper/*.java" debug="off"/>
		<jar jarfile="${base_jars}${wrapper}.jar"
basedir="${wrapper.destination_classes}"/>
</target>

<--------

<<<<<<<<<<<<<<<<<<<<<<<<<<<
<sitewaerts> GmbH
Hebelstr. 15
76133 Karlsruhe
Germany

Tel.:  	+49 (721) 920 918 20
Fax:  	+49 (721) 920 918 29

mailto:hoppe@sitewaerts.de
http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>
 

ANT and classpath problem (newbie)

Posted by Alberto Silva <al...@nmp.es>.
Hi,

I'm having an error when trying to compile with ant the sample web aplication that comes with tomcat-3.1 ($TOMCAT_HOME/docs/appdev/sample). I always get an eror about  'java.lang.NoClassDefFoundError'. I think the error is made by ant, but... I am newbie with Java, servlets and jsp, so i am not sure.

I get 3 diferent errors (I think the build.xml file is correct):


Error N1
=====================================================================
With this build shell script ...

------

# Identify the custom class path components we need
CP=$TOMCAT_HOME/classes:$TOMCAT_HOME/lib/ant.jar:$TOMCAT_HOME/lib/xml.jar
CP=$CP:$TOMCAT_HOME/lib/jasper.jar:$TOMCAT_HOME/lib/servlet.jar
CP=$CP:$TOMCAT_HOME/lib/webserver.jar

# Execute ANT to perform the requested build target
java -classpath $CP:$CLASSPATH org.apache.tools.ant.Main \
 -Dtomcat.home=$TOMCAT_HOME "$@"

------

... and this classpath ...

.:/usr/local/home/rbin/jdk1.2.2/lib:/usr/local/home/rbin/jdk1.2.2/lib/tools.jar
:/usr/local/home/rbin/jswdk-1.0.1/lib/servlet.jar:/usr/local/home/rbin/jswdk-1.0.1/lib/jsp.jar
:/usr/local/home/rbin/jaxp1.0.1/jaxp.jar:/usr/local/home/rbin/jaxp1.0.1/parser.jar
:/usr/local/home/rbin/ant/lib/ant.jar:/usr/local/home/rbin/ant/lib/moo.jar
:/usr/local/home/rbin/ant/lib/xml.jar


... I get this error:

[root@reznor sample]# ./build 
Couldn't find or load essential class `java/lang/Object' java.lang.NoClassDefFoundError java/lang/Object





Error N2
=====================================================================
With this build shell script (without the local classpath defined in the script)...

------

# Execute ANT to perform the requested build target
java org.apache.tools.ant.Main \
 - Dtomcat.home = $TOMCAT_HOME "$@"

------

... and this classpath ...

.:/usr/local/home/rbin/jdk1.2.2/lib:/usr/local/home/rbin/jdk1.2.2/lib/tools.jar
:/usr/local/home/rbin/jswdk-1.0.1/lib/servlet.jar:/usr/local/home/rbin/jswdk-1.0.1/lib/jsp.jar
:/usr/local/home/rbin/jaxp1.0.1/jaxp.jar:/usr/local/home/rbin/jaxp1.0.1/parser.jar
:/usr/local/home/rbin/ant/lib/ant.jar:/usr/local/home/rbin/ant/lib/moo.jar
:/usr/local/home/rbin/ant/lib/xml.jar

... I get this error:


[root@reznor sample]# ./build 
java.lang.ArrayIndexOutOfBoundsException
	at org.apache.tools.ant.Main.main(Main.java:142)





Error N3
=====================================================================
With this build shell script (without the local classpath defined in the script AND especifying a target to the build script)...

------

(the same script as case 2)

# Execute ANT to perform the requested build target
java org.apache.tools.ant.Main \
 - Dtomcat.home = $TOMCAT_HOME "$@"

------

... and this classpath ...

(the same classpath as case 2)

.:/usr/local/home/rbin/jdk1.2.2/lib:/usr/local/home/rbin/jdk1.2.2/lib/tools.jar
:/usr/local/home/rbin/jswdk-1.0.1/lib/servlet.jar:/usr/local/home/rbin/jswdk-1.0.1/lib/jsp.jar
:/usr/local/home/rbin/jaxp1.0.1/jaxp.jar:/usr/local/home/rbin/jaxp1.0.1/parser.jar
:/usr/local/home/rbin/ant/lib/ant.jar:/usr/local/home/rbin/ant/lib/moo.jar
:/usr/local/home/rbin/ant/lib/xml.jar

... I get this error:


[root@reznor sample]# ./build compile|all
Buildfile: build.xml
Detected Java Version: 1.2
Project base dir set to: /usr/local/home/root/devel/servlets/tomcat/sample/.
Executing Target: prepare
[copydir]Source directory /usr/local/home/root/devel/servlets/tomcat/sample/./lib does not exist.
Executing Target: compile
Compiling 1 source files to /home/rbin/tomcat-3.1/webapps/sample/WEB-INF/classesjava.lang.NoClassDefFoundError: java/util/ArrayList
	at org.apache.tools.ant.taskdefs.Javac.doClassicCompile(Javac.java:402)
	at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:221)
	at org.apache.tools.ant.Target.execute(Target.java:123)
	at org.apache.tools.ant.Project.runTarget(Project.java:471)
	at org.apache.tools.ant.Project.executeTarget(Project.java:370)
	at org.apache.tools.ant.Main.runBuild(Main.java:232)
	at org.apache.tools.ant.Main.main(Main.java:173)







Any idea?? The error changes and I have tried all the distributios from ant (ant1.1, ant1.0.8, ant from tomcat 3.1, ant from tomcat 3.0, src, nigthly, etc)


It seems that something is wrong with my jdk installation, I can't compile the ant or the tomcat src too, I always get the 'java.lang.NoClassDefFoundError'

My enviroment:
RedHat 6.1
JDK 1.2.2 Release Candidate 4
jswdk-1.0.1
jaxp1.0.1
Tomcat 3.1 (bin distro)
ant 1.1 (bin distro)


I would like to start making my own web applications, but without ant, it is imposible to me.

Lots of thanks for your support.







____________________________________________________________
Alberto Silva                 - alberto@nmp.es -       -o)
http://www.nmp.es             - 948 19 79 83   -        /\
GNU/Linux Registered and Supporter User N.122522       _\_v
____________________________________________________________
Ordenagailu baten gauzarik garrantzitsuena aulkia eta
teklatuaren artean dago



Re: Ant Property Madness??

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "DH" == Daniel Hoppe <ho...@sitewaerts.de> writes:

 DH> After some playing around with the buildfile, we figured out that
 DH> everything works fine if we place all targets using properties
 DH> after the init target. Did we miss something obvious?

This is the way Ant 1.1 works and I'm a little bit puzzled as to why
it should have been different in earlier versions. Which version has
this been - i.e. can you remember when and where you've obtained it?

The behavior of <property> and ${} expansion has been changed in CVS
very recently, your old build files would probably work as expected
with 1.2alpha2 but I wouldn't recommend using it in a production
environment yet.

Stefan