Official Eclipse contains a very old version of my Ant export filter plug-in. Here is the update!
- 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
Window -> Preferences -> eclipse2ant
File -> Export -> General -> Ant Buildfiles (eclipse2ant Plug-In)
Features available in Eclipse since 3.1
- Creates buildfile with the following targets:
||Compile project and also required projects.
||Compile project with Eclipse compiler. This requires to execute target init-eclipse-compiler
||Build all projects which reference this project. Useful to propagate changes.
||Build projects required by current project.
||Clean target directories of project.
||Clean target directories of all required projects.
||Copies resources according to your Eclipse settings (by default Eclipse copies all
resource files to classes directory).
||Copy Eclipse compiler jars to Ant lib directory.
||Run main class. One target for each main class from your run configuration.
||Run applet in appletviewer. One target for each applet from your run configuration.
||Run JUnit test(s). One target for each test(suite) from your run configuration.
||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
- 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).
Here are some buildfiles created by eclipse2ant:
||2 source dirs, 1 main, 1 test
||Plug-in project (Used to compile this plug-in), eclipse compiler, copy resources User buildfile
||Eclipse variables, bootclasspath, applet (very synthetic example)
Is it possible to export every Eclipse project to a matching Ant buildfile?
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
Eclipse Public License 2.0