Skip to Content

<jdtProjectFileSet>

Scope: JDT Projects

Description

The jdtProjectFileSet works like the 'regular' Ant FileSet. It lists all resources from all source and/or output folders of a jdt project. It can be used whereever Ant supports a Resource Collection, for example in the jar or copy tasks.

Arguments

The jdtProjectFileSet type defines the following attributes:

Argument Description Required
workspaceDirectory Absolute path of the workspace directory Either 'workspaceDirectory' or 'workspaceId' has to be specified
workspaceId The identifier of a defined workspace (see <workspaceDefinition>) Either 'workspaceDirectory' or 'workspaceId' has to be specified
projectName Name of the eclipse project yes
includeOutputFolders Determines whether the contents of the project's output folder(s) should be included in the FileSet no (defaults to true)
includeSourceFolders Determines whether the contents of the project's sourcefolder(s) should be included in the FileSet no (defaults to false)
defaultexcludes Indicates whether Ant's default excludes should be used or not (yes | no); default excludes are used when omitted. no
includes comma- or space-separated list of patterns of files that must be included; all files are included when omitted. no
excludes comma- or space-separated list of patterns of files that must be excluded; no files (except default excludes) are excluded when omitted. no

Nested Elements

The jdtProjectFileSet supports include and exclude sub-elements that can be used to specify which resources should (not) be included in the result. Both sub-elements support a name attribute that must be set to the pattern.

Example usage

The following code creates a jar file that contains the contents of all output folders of a project

<jar destfile="r:/my-project.jar">
  <ant4eclipse:jdtProjectFileSet workspaceDirectory="${workspaceDirectory}" 
    projectName="my-project"/>
</jar>

This examples creates a source jar of a project:

<jar destfile="r:/my-project-sources.jar">
  <ant4eclipse:jdtProjectFileSet workspaceDirectory="${workspaceDirectory}" 
    projectName="my-project" includeSourceFolders="true" includeOutputFolders="false"/>
</jar>

Copies all non-java resources from both source and output folders of a project:

<copy todir="c:/resources">
  <ant4eclipse:jdtProjectFileSet workspaceDirectory="${workspaceDirectory}" 
    projectName="my-project" includeSourceFolders="true" includeOutputFolders="true">
    <exclude name="**/*.java"/>
  </ant4eclipse>
</copy>