Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

export/import Eclipse build path

Tags:

java

path

eclipse

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)

like image 412
Jason S Avatar asked Aug 20 '09 15:08

Jason S


People also ask

Where is Eclipse build path stored?

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.

How do I fix Eclipse build path?

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.

How do I add missing build path entries in Eclipse?

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.


2 Answers

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>
like image 127
rodrigoap Avatar answered Sep 19 '22 07:09

rodrigoap


Maybe ant4eclipse is the tool (plugin) you need.

alt text
(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!

like image 40
VonC Avatar answered Sep 19 '22 07:09

VonC