This plugin automatically creates a build.xml file in newly created projects. This enables Ant-based builds within a bnd workspace.
How It Works
When a new project is created in the workspace, the Ant plugin will:
- Look for a custom template at
cnf/ant/project.xmlin the workspace - If found, copy the custom template to the new project as
build.xml - If not found, use a default
build.xmlthat imports the workspace build configuration
Default Template
If no custom template is provided, the plugin uses a default build.xml template that:
<?xml version='1.0' encoding='UTF-8'?>
<project name='project' default='build'>
<import file='../cnf/build.xml' />
</project>
This default template imports the workspace-level Ant configuration from cnf/build.xml, allowing individual projects to benefit from centralized build definitions.
Customization
To use a custom Ant build template:
- Create a file at
cnf/ant/project.xmlin your workspace - This template will be copied to each new project’s
build.xmlfile - You can use project-specific properties and targets as needed
Usage in build.bnd
The Ant plugin is typically enabled automatically in bnd workspaces. If you need to explicitly enable it or configure it, add the following to your cnf/build.bnd:
-plugin.Ant: \
aQute.bnd.plugin.ant.AntPlugin
When you create a new project in the workspace (either through the bnd CLI or IDE), the plugin will automatically generate the build.xml file for that project.
Example Workspace Setup
To use a custom Ant template:
- Create your custom template at
cnf/ant/project.xml:
<?xml version='1.0' encoding='UTF-8'?>
<project name='${project.name}' default='build' basedir='.'>
<property name='src' value='src'/>
<property name='bin' value='bin'/>
<import file='../cnf/build.xml' />
<target name='compile'>
<javac srcdir='${src}' destdir='${bin}'/>
</target>
</project>
- When a new project is created, this template will be used instead of the default.
TODO Needs review - AI Generated content