eclipse2ant Plug-in
Official Eclipse contains a very old version of my Ant export filter plug-in. Here is the update!
New Features
- Auto export: Buildfiles are automatically exported if the build path changes.
- Preference page. Save and restore settings with preference export / import.
- Wizard remembers settings.
- Export configured text file encoding for Ant buildfile, Java sources and run configurations.
Download eclipse2ant for Eclipse 2021-09 (4.21.0) - Java 11
- Download: eclipse2ant_1.3.6.zip
- Start Eclipse Update Manager: Eclipse -> Help -> Install New Software -> Add -> Archive
Sources
Shortcut
Window -> Preferences -> eclipse2ant
Shortcut
File -> Export -> General -> Ant Buildfiles (eclipse2ant Plug-In)
Features available in Eclipse since 3.1
- Creates buildfile with the following targets:
Target |
Description |
build |
Compile project and also required projects. |
build-eclipse-compiler |
Compile project with Eclipse compiler. This requires to execute target init-eclipse-compiler
before.
|
build-refprojects |
Build all projects which reference this project. Useful to propagate changes. |
build-subprojects |
Build projects required by current project. |
clean |
Clean target directories of project. |
cleanall |
Clean target directories of all required projects. |
init |
Copies resources according to your Eclipse settings (by default Eclipse copies all
resource files to classes directory). |
init-eclipse-compiler |
Copy Eclipse compiler jars to Ant lib directory. |
MainClass |
Run main class. One target for each main class from your run configuration. |
Applet |
Run applet in appletviewer. One target for each applet from your run configuration. |
JUnitTest |
Run JUnit test(s). One target for each test(suite) from your run configuration. |
junitreport |
Generate JUnit report |
- Only project relative paths are created to offer highest portability.
- Supports multiple source/classes directories, include/exclude patterns.
- (Class)path variables are converted to properties.
- Supports project dependencies (creates build file for each required project).
- Export run configuration for applications, applets and JUnit tests.
- Exports arguments, VM arguments, working directory, environment.
- Eclipse variables and string subsitution are converted to properties.
- Export compiler and runtime (boot)classpath.
- Imports automatically all valid buildfiles in same directory which have this processing instruction
as first child: <?eclipse.ant.import?>. example user build file
- Export debug options and source/target compatibility level.
- Support version control plug-ins (confirms to checkout files, add new files, make writable if
read-only)
- Support linked resources.
- Analyze project for Ant compatibility and report what to change. (Detect cycle in source folders
and check correct order of source folders).
Examples
Here are some buildfiles created by eclipse2ant:
buildfile |
Used features |
build.xml |
2 source dirs, 1 main, 1 test |
build.xml |
Project dependencies |
build.xml |
Plug-in project (Used to compile this plug-in), eclipse compiler, copy resources User buildfile |
build.xml |
Eclipse variables, bootclasspath, applet (very synthetic example) |
FAQ
Q: Is it possible to export every Eclipse project to a matching Ant buildfile?
A: Short answer: No. But eclipse2ant helps you to make it compatible: It's easy! First
you have to eliminate project cycles (by default Eclipse shows an error). Then check the dependencies in
the source folders of your project. In Eclipse you can specifiy for every source directory a different
classes directory. eclipse2ant will create a <javac> tag for every source directory.
Therefore no cyclic dependencies are allowed between them. eclipse2ant informs you in detail how you can
eliminate the cycle:
Furthermore the order of the sources in the buildpath is also relevant. Again eclipse2ant shows you
detailed information what to change:
Simply change order in Eclipse -> Project -> Properties -> Java Build Path -> Order and
Export
License
Eclipse Public License 2.0
Home