I was working in a custom ATG module in which I required to extend a core ATG class. When I ran the build ant command I got compile errors because of "cannot find symbol", in other words, my dear reference class was not being recognized. It was missing! In my Eclipse project I got no errors because I had the right library included in the project's classpath.
I started looking on how to add additional JAR files to the classpath, but after digging a little bit more in the compile target referenced in the build.xml:
1 | < target name = "build" depends = "echo-build-message,clean,compile,jar-classes,jar-configs,copy-to-install" /> |
I saw how could I add additional classpath entries using the reference id "classpath.additions". In the included common.xml file we had this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | < target name = "compile" > < mkdir dir = "${java.output.dir}" /> < mkdir dir = "${java.src.dir}" /> < copy todir = "${java.output.dir}" > < fileset dir = "${java.src.dir}" > < include name = "**/*.properties" /> < include name = "**/*.xml" /> </ fileset > </ copy > < if > < isreference refid = "classpath.additions" /> < then > < path id = "fullClasspath" > < path refid = "classpath" /> < path refid = "classpath.additions" /> </ path > </ then > < else > < path id = "fullClasspath" > < path refid = "classpath" /> </ path > </ else > </ if > < echo message = "java.src.dir: ${java.src.dir}, java.output.dir: ${java.output.dir}" /> < javac srcdir = "${java.src.dir}" destdir = "${java.output.dir}" classpathref = "fullClasspath" debug = "on" includeAntRuntime = "false" /> </ target > |
So I just added this in the build.xml:
1 2 3 | < path id = "classpath.additions" > < fileset dir = "${dynamo.home}/../REST/lib" >< include name = "**/*.jar" /></ fileset > </ path > |