blob: a47d8504ef12132fe924b50cac716afb75a271d3 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<script type="text/javascript">var xookiConfig = {level: 1};</script>
<script type="text/javascript" src="../xooki/xooki.js"></script>
</head>
<body>
<textarea id="xooki-source">
<span class="since">since 2.0</span>
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.
<em>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.</em>
<span class="since">since 2.2</span>
It is possible to specify a template file defining the structure of the generated POM. The following processing is done on this template:
<ul>
<li>properties like <i>${property.name}</i> are replaced if they are defined in Ant or by the ivy:makepom task (see below for the standard properties)</li>
<li>lines containg the string <i>SKIP_LINE</i> are skipped.</li>
<li>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.
</ul>
The ivy:makepom task defines following properties that can be used in the template. <ul>
<li><b>ivy.pom.groupId</b>: defaults to the organisation as defined in the ivy.xml file</li>
<li><b>ivy.pom.artifactId</b>: defaults to the value of the 'atifactName' attribute of this task, or the name of the module as defined in the ivy.xml file</li>
<li><b>ivy.pom.packaging</b>: defaults to the value of the 'artifactPackaging' attribute of this task, or the extenstion of the artifact</li>
<li><b>ivy.pom.version</b>: defaults to the revision as defined in the ivy.xml file</li>
<li><b>ivy.pom.name</b>: defaults to 'SKIP_LINE'</li>
<li><b>ivy.pom.description</b>: defaults to the value of the 'description' attribute of this task, or 'SKIP_LINE' when not specified</li>
<li><b>ivy.pom.url</b>: defaults to the homepage as defined in the ivy.xml file</li>
<li><b>ivy.pom.license</b>: the content of the specified headerFile, or 'SKIP_LINE' if not specified</li>
<li><b>ivy.pom.header</b>: some Ivy information, or 'SKIP_LINE' if the 'printIvyInfo' attribute is set to false.</li>
</ul>
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:
<code type="xml">
${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>
</code>
<h1>Attributes</h1>
<table class="ant">
<thead>
<tr><th class="ant-att">Attribute</th><th class="ant-desc">Description</th><th class="ant-req">Required</th></tr>
</thead>
<tbody>
<tr><td>ivyfile</td><td>the source ivy file to convert</td>
<td>Yes</td></tr>
<tr><td>pomfile</td><td>the destination pom file to write</td>
<td>Yes</td></tr>
<tr><td>templatefile</td><td>the template file to use when generating the pom <span class="since">(since 2.2)</span></td>
<td>No, defaults to the internal template file.</td></tr>
<tr><td>artifactName</td><td>The name of the artifact which is represented by the generated pom file. <span class="since">(since 2.2)</span></td>
<td>No, defaults to the module name in the source ivy file.</td></tr>
<tr><td>artifactPackaging</td><td>The packaging of the artifact which is represented by the generated pom file. <span class="since">(since 2.2)</span></td>
<td>No, the artifact type is taken by default. Defaults to 'pom' if no such artifact is defined.</td></tr>
<tr><td>conf</td><td>a comma separated list of the configurations to include in the generated pom. Wildcards are supported here. <span class="since">(since 2.2)</span></td>
<td>No, defaults to all configurations.</td></tr>
<tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task</td>
<td>No, 'ivy.instance' is taken by default.</td></tr>
<tr><td>printIvyInfo</td><td>Add some information about Ivy to the generated POM. <span class="since">(since 2.2)</span></td>
<td>No, defaults to 'true'.</td></tr>
<tr><td>headerFile</td><td>the header of the generated pom file</td>
<td>No</td></tr>
<tr><td>description</td><td>The description that will be added to the generated pom. <span class="since">(since 2.2)</span></td>
<td>No, defaults to no description. Since 2.5, defaults to the description in the source ivy file.</td></tr>
</tbody>
</table>
<h1>Child elements</h1>
<table class="ivy-children">
<thead>
<tr><th class="ivy-chld">Element</th><th class="ivy-chld-desc">Description</th><th class="ivy-chld-card">Cardinality</th></tr>
</thead>
<tbody>
<tr><td>mapping</td>
<td>describes the mapping from an Ivy module configuration to a Maven POM scope.<br/>These elements takes two attributes: <ul><li>conf</li> the configuration to map<li>scope</li>the scope to which it should be mapped</ul></td>
<td>0..n</td></tr>
<tr><td>dependency</td>
<td>describes extra dependencies that should be added to the generated Maven POM file.<br/>These elements takes the following attributes: <ul><li>group</li> the groupId. Default <i>organisation</i> as defined in <i>info</i><li>artifact</li> the name of the artifact<li>version</li> the version. Default <i>revision</i> as defined in <i>info</i><li>type <span class="since">(since 2.3)</span></li> the type<li>classifier <span class="since">(since 2.3)</span></li> the classifier<li>scope</li> the scope<li>optional</li> is the artifact optional. Default <i>false</i></ul></td>
<td>0..n</td></tr>
</tbody>
</table>
<h1>Examples</h1>
<code type="xml">
<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>
</code>
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 <i>com.acme.acme-logging</i> artifact with version 1.0 will be added as an optional dependency.
</textarea>
<script type="text/javascript">xooki.postProcess();</script>
</body>
</html>