# Ant tasks for publishing p2 metadata

Since Eclipse 3.5, p2 ships with two publisher ant tasks. The ant tasks are contained in `org.eclipse.equinox.p2.publisher`. This bundles is part of the Eclipse SDK.

`Default Attributes`

The `p2.publish.*` ant tasks outlined below all support the following attributes:

`metadataRepository` | A URL specifying the metadata repository to publish to.
`artifactRepository` | A URL specifying the artifact repository to publish to.
`repository` | Sets both metadataRepository and artifactRepository.
`metadataRepositoryName` | When creating a new metadata repository, sets the name.
`artifactRepositoryName` | When creating a new artifact repository, sets the name.
`repositoryName` | Sets both metadataRepositoryName and artifactRepositoryName.
`append` | Whether to append to the repository. (Default is "true")
`compress` | When creating a new repository, whether or not to compress the metadata. (Default is "false")
`publishArtifacts` | Whether or not to publish the artifacts. (Default is "true")
`reusePackedFiles` | Whether or not to include discovered Pack200 files in the repository. (Default is "false")

`<contextRepository>`

Nested elements specifying context repositories, supports the following attributes:

`location` | A URL specifying the location of the repository.
`artifact` | "true" or "false": whether or not there is an artifact repository at this location.
`metadata` | "true" or "false": whether or not there is a metadata repository at this location.

If a given context repository contains metadata for one of the features or bundles that are being published, then that metadata will be re-used instead of generating new metadata.

`p2.publish.featuresAndBundles`
This task will publish metadata for pre-existing binary features and plug-ins.

This task supports the following attributes and elements:

`source` | A folder containing plugins and features subfolders to publish.
`<features>` | A nested fileset element specifying the locations of binary features to publish.
`<bundles>` | A nested fileset element specifying the locations of binary plug-ins to publish.

`p2.publish.product`
Publish a .product file. This task assumes everything included in the product already exists in the repository. (That is, all features and bundles have been previously published.)

This task supports the following attributes:

`flavor` | Set the flavor for the p2 metadata, default is "tooling". Products should consider using a unique flavor if they have special requirements for bundle start levels.
`productFile` | The location of the .product file describing the product.
`executables` | The location of the executables feature. This is the feature that is used for branding and publishing the executables.
`<config>` | Nested elements specifying configurations supported by this product. Config elements specify ws, os and arch: `<config ws="gtk" os="linux" arch="x86" />`

`<advice>`

Nested elements specifying specifying additional advice to use when creating the product. Currently the accepted kinds of advice are "featureVersions" and "pluginVersions".
`<advice kind="featureVersions" file="finalFeaturesVersions.properties" />
<advice kind="pluginVersions" file="finalPluginsVersions.properties" />`
PDE/Build will generate these version properties files when the builder sets the property `generateVersionsLists`".

In addition to the publisher tasks, metadata can be generated as part of PDE Build.