I like Eclipse's build path features, but would like to keep it in sync with my ant build.xml
. Is there a way to either automatically import the Eclipse build path from a text file, or export the Eclipse build path to a text file, so I can use that file from ant? (if I can get to a text file, I know I can figure out how to get ant to use that file as its javac build path)
The build classpath is stored in a special file called '. classpath', and there's also one called '. project' as well. Make sure you copy both of those files along with the rest of it, and use your OS' normal capabilities for performing a duplication of folder contents.
Procedure. In Eclipse select the web project and right-click Build Path > Configure Build Path. This will display the Java Build Path window. Add the CICS and Liberty libraries, click Add Library > CICS Liberty libraries > Next > Finish.
Right-click on the project and choose properties. Click on the Java Build Path option in the left side menu. From the Java Build Path window, click on the Libraries Tab. Make sure JRE System library is listed, if it is not listed then you can add, by clicking "Add Library" from the right side menu.
Is there a way to either automatically import the Eclipse build path from a text file, or export the Eclipse build path to a text file, so I can use that file from ant?
The Eclipse build path already is a text file (.classpath):
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/ojdbc14_g.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Maybe ant4eclipse is the tool (plugin) you need.
(source: sourceforge.net)
The aim of the
ant4eclipse
project is to avoid (or at least: to reduce) the redundancy of Eclipse and Ant configurations.
More precisely: it consists of Ant tasks that are able to read and work with some of Eclipse's configuration files. With these tasks you're able to:
- Setup classpathes as defined in Eclipse' .classpath-file
- checkout complete workspaces as it's possible with the Team Project Set feature of eclipse
- run your Java applications as you have defined them in an Eclipse Launch Configuration
With all these tasks you're able to create a complete automatic build system that starts with checking out all required projects from CVS, builds all projects in the correct order with classpath settings as specified in Eclipse, and to launch your applications as they are specified in Eclipse.
And the best of it: if you or someone else changes a configuration in Eclipse, those changes are immediately visible to your buildfiles - without changing one line of code!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With