mirror of https://github.com/apache/ant-ivy
132 lines
5.4 KiB
Plaintext
132 lines
5.4 KiB
Plaintext
|
|
*__since 2.0__*
|
|
The makepom task allows to convert an ivy file to a pom file.
|
|
|
|
An example of use is to publish an Ivy managed module to a maven 2 repository.
|
|
|
|
_Note that all Ivy features are not supported by maven poms, so the converted pom may not resolve to the exact same dependencies as the original ivy file._
|
|
|
|
*__since 2.2__*
|
|
It is possible to specify a template file defining the structure of the generated POM. The following processing is done on this template:
|
|
|
|
|
|
* properties like __${property.name}__ are replaced if they are defined in Ant or by the ivy:makepom task (see below for the standard properties) +
|
|
|
|
* lines containg the string __SKIP_LINE__ are skipped. +
|
|
|
|
* the defined dependencies will be added to the first <dependencies> element encountered in the pom template. If the template doesn't contain a <dependencies> element, it is generated a the end of the pom.
|
|
|
|
|
|
The ivy:makepom task defines following properties that can be used in the template.
|
|
|
|
* *ivy.pom.groupId*: defaults to the organisation as defined in the ivy.xml file +
|
|
|
|
* *ivy.pom.artifactId*: defaults to the value of the 'atifactName' attribute of this task, or the name of the module as defined in the ivy.xml file +
|
|
|
|
* *ivy.pom.packaging*: defaults to the value of the 'artifactPackaging' attribute of this task, or the extenstion of the artifact +
|
|
|
|
* *ivy.pom.version*: defaults to the revision as defined in the ivy.xml file +
|
|
|
|
* *ivy.pom.name*: defaults to 'SKIP_LINE' +
|
|
|
|
* *ivy.pom.description*: defaults to the value of the 'description' attribute of this task, or 'SKIP_LINE' when not specified +
|
|
|
|
* *ivy.pom.url*: defaults to the homepage as defined in the ivy.xml file +
|
|
|
|
* *ivy.pom.license*: the content of the specified headerFile, or 'SKIP_LINE' if not specified +
|
|
|
|
* *ivy.pom.header*: some Ivy information, or 'SKIP_LINE' if the 'printIvyInfo' attribute is set to false. +
|
|
|
|
Note that each property can be given a value manually in the Ant build file. In that case, Ivy will use the value specified in the build file instead of the default value.
|
|
|
|
The default template that ships with Ivy looks like this:
|
|
|
|
[source]
|
|
----
|
|
|
|
${ivy.pom.license}
|
|
${ivy.pom.header}
|
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
|
|
<modelVersion>4.0.0</modelVersion>
|
|
<groupId>${ivy.pom.groupId}</groupId>
|
|
<artifactId>${ivy.pom.artifactId}</artifactId>
|
|
<packaging>${ivy.pom.packaging}</packaging>
|
|
<version>${ivy.pom.version}</version>
|
|
<name>${ivy.pom.name}</name>
|
|
<description>${ivy.pom.description}</description>
|
|
<url>${ivy.pom.url}</url>
|
|
</project>
|
|
|
|
----
|
|
|
|
|
|
== Attributes
|
|
|
|
|
|
[options="header",cols="15%,50%,35%"]
|
|
|=======
|
|
|Attribute|Description|Required
|
|
|ivyfile|the source ivy file to convert|Yes
|
|
|pomfile|the destination pom file to write|Yes
|
|
|templatefile|the template file to use when generating the pom *__(since 2.2)__*|No, defaults to the internal template file.
|
|
|artifactName|The name of the artifact which is represented by the generated pom file. *__(since 2.2)__*|No, defaults to the module name in the source ivy file.
|
|
|artifactPackaging|The packaging of the artifact which is represented by the generated pom file. *__(since 2.2)__*|No, the artifact type is taken by default. Defaults to 'pom' if no such artifact is defined.
|
|
|conf|a comma separated list of the configurations to include in the generated pom. Wildcards are supported here. *__(since 2.2)__*|No, defaults to all configurations.
|
|
|settingsRef|A reference to the ivy settings that must be used by this task|No, 'ivy.instance' is taken by default.
|
|
|printIvyInfo|Add some information about Ivy to the generated POM. *__(since 2.2)__*|No, defaults to 'true'.
|
|
|headerFile|the header of the generated pom file|No
|
|
|description|The description that will be added to the generated pom. *__(since 2.2)__*|No, defaults to no description. Since 2.5, defaults to the description in the source ivy file.
|
|
|=======
|
|
|
|
|
|
== Child elements
|
|
|
|
|
|
[options="header"]
|
|
|=======
|
|
|Element|Description|Cardinality
|
|
|mapping|describes the mapping from an Ivy module configuration to a Maven POM scope.
|
|
These elements takes two attributes:
|
|
* conf +
|
|
the configuration to map
|
|
* scope +
|
|
the scope to which it should be mapped|0..n
|
|
|dependency|describes extra dependencies that should be added to the generated Maven POM file.
|
|
These elements takes the following attributes:
|
|
* group +
|
|
the groupId. Default __organisation__ as defined in __info__
|
|
* artifact +
|
|
the name of the artifact
|
|
* version +
|
|
the version. Default __revision__ as defined in __info__
|
|
* type *__(since 2.3)__* +
|
|
the type
|
|
* classifier *__(since 2.3)__* +
|
|
the classifier
|
|
* scope +
|
|
the scope
|
|
* optional +
|
|
is the artifact optional. Default __false__|0..n
|
|
|=======
|
|
|
|
|
|
|
|
== Examples
|
|
|
|
|
|
[source]
|
|
----
|
|
|
|
<ivy:makepom ivyfile="${basedir}/path/to/ivy.xml" pomfile="${basedir}/path/to/module.pom" conf="default,runtime">
|
|
<mapping conf="default" scope="compile"/>
|
|
<mapping conf="runtime" scope="runtime"/>
|
|
<dependency group="com.acme" artifact="acme-logging" version="1.0" optional="true"/>
|
|
</ivy:makepom>
|
|
|
|
----
|
|
|
|
Converts ${basedir}/path/to/ivy.xml to a pom and writes the result to ${basedir}/path/to/module.pom. The configuration 'default' in the parsed ivy file will be mapped to the scope 'compile', the configuration 'runtime' will be mapped to 'runtime', and other configurations will be excluded.
|
|
|
|
The __com.acme.acme-logging__ artifact with version 1.0 will be added as an optional dependency. |