• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ANT Javac/classpath problem

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am having trouble getting ANT to compile some code. ANT says that the build is successful, but the files are not compiled and they are not moved from the development directory to the deployment directory.

I have the following properties in my build.xml file:

<property name="srcDirWeb" location="src/org/novastaff/web"/>
<property name="classDirWeb" location="classes/org/novastaff/web"/>
<property name="deployClassWeb" location="/usr/local/tomcat/jakarta-tomcat-4.1.27/webapps/EarnCalc-v1/WEB-INF/classes/org/novastaff/web"/>

I can compile the code from the command line with:

javac -classpath /usr/local/tomcat/jakarta-tomcat-4.1.27/common/lib/servlet.jar:classes:. -d classes src/org/novastaff/web/EarningsCalculator.java

My ANT target looks like this:

<target name="compile" depends="copy-xml"
description="Compiles the java source files">
<javac srcdir="${srcDirWeb}"
destdir="${classDirWeb}"
classpath="/usr/local/tomcat/jakarta-tomcat-4.1.27/common/lib/servlet.jar:classes:."
includes="org/novastaff/web/**"/>
</target>

My guess is that the error is in the classpath, but I could be wrong.

Any help wit this problem would be greatly appreaciated!

Thanks,

Elton
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Run Ant with the -verbose option, or even -debug and see wether that gives you any hints on what's happening...
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like it's just not finding anything to compile.

You're telling it to compile source from src dir src/org/novastaff/web including org/novastaff/web/**
(meaning src/org/novastaff/web/org/novastaff/web/** ).

Instead try these as properties:
srcDir defined as "src"
classDir defined as "classes"

These in javac task:
srcdir="${srcDir}"
destdir="${classDir}"
includes="org/novastaff/web/**"

Then if you run with -v like Ilja suggested you should be able to see what it is trying to do.


[ February 14, 2005: Message edited by: Carol Enderlin ]
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ilja and Carol,

Using -verbose provided an wealth of information. Carol was correct. javac was not finding anything to compile. Using her suggestion, I modified the src property and the application compiles now.

Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic