Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Ant, Maven and Other Build Tools and the fly likes Issues with setting classpath in Ant BuildScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Issues with setting classpath in Ant BuildScript" Watch "Issues with setting classpath in Ant BuildScript" New topic
Author

Issues with setting classpath in Ant BuildScript

Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 93

Hi All,

I have some issues in setting the classpath for the a project for which Im trying to create a jar using the Ant build script. For eg: Consider a project A in the workspace. This project has internal dependencies with other projects in the workspace. There are project B, C, D in my workspace, which are added to the build path of the Project A. I have the below compile script in the build.xml. When I try to execute the script, the compile does not seem to happen, due to issues with classpath. Please find the code below.



When I try to execute the script, I get the error at this line '<javac srcdir="../A/src" destdir="${Classfiles}" />' saying that compilation fails. Require help in setting the classpath in the buildscript. Thanks in Advance
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

You should reference the bin directory, not the src directory, in the classpath (assuming you kept the default location for the compiled files), example:



Also, you have to make sure that the projects B, C and D are compiled before you can run the build for A. (You might need a master script that builds the projects in the correct order.)


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issues with setting classpath in Ant BuildScript