Hang Ngo’s Blog

eclipse2ant Plugin

Posted by tuanvinh on November 8, 2007

eclipse2ant Plugin

This small plugin allows you to export project settings to an Ant build file. My export filter tries to create a buildfile that matches the Eclipse project as close as possible.It adds a new export filter item (File -> Export -> Ant Buildfile).

Features

  • New: bootclasspath fully supported, code coverage increased from 38.7% to 81%.
  • Creates 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 plugins (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).
  • Offer single file compile. Not available in official Eclipse by intention. Of course a candidate for a standalone plugin…
    • Adds a new context menu item called “Compile” to Java editor.