maven-plugins/source/plugin.jelly
2006-02-24 18:32:34 +00:00

145 lines
5.2 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
-->
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:artifact="artifact"
xmlns:util="jelly:util"
xmlns:i="jelly:interaction"
xmlns:define="jelly:define"
xmlns:maven="jelly:maven"
xmlns:source="source">
<define:taglib uri="source">
<define:jellybean
name="download-java-sources"
className="org.apache.maven.plugin.source.JavaSourcesDownloader"
method="downloadJavaSources"/>
</define:taglib>
<j:new var="javaSourceTypeHandler" className="org.apache.maven.plugin.source.JavaSourceArtifactTypeHandler" />
<!-- ================================================================== -->
<!-- S O U R C E -->
<!-- ================================================================== -->
<goal name="source" prereqs="source:source"
description="Create the source archive."/>
<goal name="source:source"
description="Create the source archive."
prereqs="java:compile">
<j:choose>
<j:when test="${pom.currentVersion == null}">
<ant:fail>You must define currentVersion in your POM.</ant:fail>
</j:when>
</j:choose>
<!-- Convert the path to fileset -->
<ant:pathconvert pathsep=";" property="java.source.paths" refid="maven.compile.src.set"/>
<util:tokenize var="java.source.paths.split" delim=";">${java.source.paths}</util:tokenize>
<ant:jar
jarfile="${maven.build.dir}/${maven.source.final.name}"
excludes="${maven.source.excludes}">
<!-- Create a fileset for each directory added to maven.compile.src.set -->
<j:forEach var="var" items="${java.source.paths.split}">
<ant:fileset dir="${var}"/>
</j:forEach>
</ant:jar>
</goal>
<!-- ================================================================== -->
<!-- D E P L O Y S O U R C E -->
<!-- ================================================================== -->
<goal
name="source:deploy"
prereqs="source:source"
description="Deploy the source archive to the remote repository">
<artifact:deploy
artifact="${maven.build.dir}/${maven.source.final.name}"
type="java-source"
project="${pom}"
typeHandler="${javaSourceTypeHandler}"/>
</goal>
<!-- ================================================================== -->
<!-- I N S T A L L S O U R C E -->
<!-- ================================================================== -->
<goal name="source:install" prereqs="source:source"
description="Install the source archive in the local repository">
<artifact:install
artifact="${maven.build.dir}/${maven.source.final.name}"
type="java-source"
project="${pom}"
typeHandler="${javaSourceTypeHandler}"/>
</goal>
<!-- ================================================================== -->
<!-- D O W N L O A D S O U R C E -->
<!-- ================================================================== -->
<goal name="source:download" description="Download a source archive from the repository">
<j:if test="${empty(artifactId)}">
<i:ask question="What is the artifactId of the source archive to download?"
answer="artifactId"/>
</j:if>
<maven:param-check value="${artifactId}" fail="true" message="'artifactId' must be specified"/>
<j:if test="${empty(groupId)}">
<i:ask question="What is the groupId of the source archive to download?"
answer="groupId"/>
</j:if>
<maven:param-check value="${groupId}" fail="true" message="'groupId' must be specified"/>
<j:if test="${empty(version)}">
<i:ask question="What is the version of the source archive to download?"
answer="version"/>
</j:if>
<maven:param-check value="${version}" fail="true" message="'version' must be specified"/>
<j:if test="${empty(ignoreErrors)}">
<j:set var="ignoreErrors" value="false"/>
</j:if>
<j:if test="${empty(backwardCompatible)}">
<j:set var="backwardCompatible" value="false"/>
</j:if>
<source:download-java-sources
project="${pom}"
groupId="${groupId}"
artifactId="${artifactId}"
version="${version}"
ignoreErrors="${ignoreErrors}"
backwardCompatible="${backwardCompatible}"
/>
</goal>
</project>