git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113192 13f79535-47bb-0310-9956-ffa450edef68
320 lines
12 KiB
XML
320 lines
12 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<project
|
|
xmlns:j="jelly:core"
|
|
xmlns:license="license"
|
|
xmlns:maven="jelly:maven"
|
|
xmlns:deploy="deploy"
|
|
xmlns:resources="resources"
|
|
xmlns:util="jelly:util"
|
|
xmlns:doc="doc"
|
|
xmlns:m="maven">
|
|
|
|
<!--
|
|
|
|
The xmlns:doc declaration is a fix for transitive dynatag dependency
|
|
problem. The introduction of license dynatag which uses the xdoc
|
|
plugin revealed the problem a day before the release. This should
|
|
allow a new user to build with no initial repo.
|
|
|
|
-->
|
|
|
|
<j:choose>
|
|
<j:when test="${!pom.build.resources.includes.isEmpty()}">
|
|
<property name="maven.has.jar.resource.patterns" value="true"/>
|
|
</j:when>
|
|
<j:when test="${!pom.build.resources.excludes.isEmpty()}">
|
|
<property name="maven.has.jar.resource.patterns" value="true"/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<property name="maven.has.jar.resource.patterns" value="false"/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
<patternset id="maven.jar.resources.set">
|
|
<j:forEach var="res" items="${pom.build.resources.includes}">
|
|
<include name="${res}"/>
|
|
</j:forEach>
|
|
<j:forEach var="res" items="${pom.build.resources.excludes}">
|
|
<exclude name="${res}"/>
|
|
</j:forEach>
|
|
</patternset>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- P R E P A R E F I L E S Y S T E M -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal name="java:prepare-filesystem"
|
|
description="Create the directory structure needed to compile">
|
|
<mkdir dir="${maven.build.dest}"/>
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- C O M P I L E -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal name="java:compile"
|
|
description="Compile the project"
|
|
prereqs="java:prepare-filesystem">
|
|
|
|
<j:choose>
|
|
<j:when test="${sourcesPresent == 'true'}">
|
|
<javac
|
|
destdir="${maven.build.dest}"
|
|
excludes="**/package.html"
|
|
debug="${maven.compile.debug}"
|
|
deprecation="${maven.compile.deprecation}"
|
|
optimize="${maven.compile.optimize}">
|
|
<src>
|
|
<path refid="maven.compile.src.set"/>
|
|
</src>
|
|
|
|
<!--
|
|
|
|
|
| Source Modifications.
|
|
|
|
|
-->
|
|
|
|
<j:forEach var="sm" items="${pom.build.sourceModifications}">
|
|
<available property="classPresent" classname="${sm.className}"/>
|
|
<j:if test="${classPresent != 'true'}">
|
|
<j:forEach var="exclude" items="${sm.excludes}">
|
|
<exclude name="${exclude}"/>
|
|
</j:forEach>
|
|
<j:forEach var="include" items="${sm.includes}">
|
|
<include name="${include}"/>
|
|
</j:forEach>
|
|
</j:if>
|
|
</j:forEach>
|
|
|
|
<classpath>
|
|
<path refid="maven.dependency.classpath"/>
|
|
<pathelement path="${maven.build.dest}"/>
|
|
</classpath>
|
|
<j:if test="${context.getVariable('maven.compile.compilerargs') != null}">
|
|
<compilerarg line="${maven.compile.compilerargs}" />
|
|
</j:if>
|
|
|
|
<j:if test="${context.getVariable('maven.compile.encoding') != null}">
|
|
<setProperty name="encoding" value="${maven.compile.encoding}" />
|
|
</j:if>
|
|
|
|
<j:if test="${context.getVariable('maven.compile.executable') != null}">
|
|
<setProperty name="executable" value="${maven.compile.executable}" />
|
|
</j:if>
|
|
|
|
<j:if test="${context.getVariable('maven.compile.fork') != null}">
|
|
<setProperty name="fork" value="${maven.compile.fork}" />
|
|
</j:if>
|
|
|
|
<j:if test="${context.getVariable('maven.compile.source') != null}">
|
|
<setProperty name="source" value="${maven.compile.source}" />
|
|
</j:if>
|
|
|
|
<j:if test="${context.getVariable('maven.compile.target') != null}">
|
|
<setProperty name="target" value="${maven.compile.target}" />
|
|
</j:if>
|
|
|
|
<j:if test="${context.getVariable('maven.compile.verbose') != null}">
|
|
<setProperty name="verbose" value="${maven.compile.verbose}" />
|
|
</j:if>
|
|
</javac>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<echo>No java source files to compile.</echo>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- J A R R E S O U R C E S -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal name="java:jar-resources"
|
|
description="Copy any resources that must be present in the deployed JAR file">
|
|
|
|
<j:if test="${!pom.build.resources.isEmpty()}">
|
|
<resources:copy
|
|
resources="${pom.build.resources}"
|
|
todir="${maven.build.dest}"
|
|
/>
|
|
</j:if>
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- J A R -->
|
|
<!-- ================================================================== -->
|
|
<goal name="jar" prereqs="java:jar"
|
|
description="Create the deliverable jar file."/>
|
|
<goal name="java:jar"
|
|
description="Create the deliverable jar file."
|
|
prereqs="test:test">
|
|
|
|
<available property="maven.jar.manifest.available"
|
|
file="${maven.jar.manifest}"/>
|
|
|
|
<jar
|
|
jarfile="${maven.build.dir}/${maven.final.name}.jar"
|
|
basedir="${maven.build.dest}"
|
|
excludes="${maven.jar.excludes}">
|
|
|
|
<j:if test="${maven.jar.manifest.available}">
|
|
<setProperty name="manifest" value="${maven.jar.manifest}" />
|
|
</j:if>
|
|
|
|
<j:set var="licenseFileName"><license:fileName/></j:set>
|
|
<util:file name="${licenseFileName}" var="licenseFile"/>
|
|
<metainf dir="${licenseFile.canonicalFile.parent}">
|
|
<include name="${licenseFile.canonicalFile.name}"/>
|
|
</metainf>
|
|
<manifest>
|
|
<attribute name="Built-By" value="${user.name}"/>
|
|
<attribute name="Created-By" value="Apache Jakarta Maven"/>
|
|
<attribute name="Package" value="${pom.package}"/>
|
|
<attribute name="Build-Jdk" value="${java.version}"/>
|
|
<!-- added supplementary entries -->
|
|
<attribute name="Extension-Name" value="${pom.artifactId}"/>
|
|
<attribute name="Specification-Version" value="${pom.specificationVersion}"/>
|
|
<attribute name="Specification-Vendor" value="${pom.organization.name}"/>
|
|
<attribute name="Specification-Title" value="${pom.shortDescription}"/>
|
|
<attribute name="Implementation-Version" value="${pom.currentVersion}"/>
|
|
<attribute name="Implementation-Vendor" value="${pom.organization.name}"/>
|
|
<attribute name="Implementation-Vendor-Id" value="${pom.organization.identifier}"/>
|
|
<j:set var="mainclass" value="${pom.getPluginContext('maven-java-plugin').getVariable('maven.jar.mainclass')}"/>
|
|
<j:if test="${!empty(mainclass)}">
|
|
<attribute name="Main-Class" value="${mainclass}"/>
|
|
</j:if>
|
|
</manifest>
|
|
</jar>
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- S N A P S H O T J A R -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal
|
|
name="jar:snapshot"
|
|
description="Create a snapshot jar, ie 'id-YYYYMMDD.hhmmss.jar'">
|
|
|
|
<maven:snapshot project="${pom}"/>
|
|
|
|
<j:set var="maven.final.name" value="${snapshotSignature}"/>
|
|
<echo>Building snapshot JAR: ${maven.final.name}</echo>
|
|
|
|
<attainGoal name="java:jar"/>
|
|
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- D E P L O Y S N A P S H O T -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal
|
|
name="jar:deploy-snapshot"
|
|
description="Deploy a snapshot jar to the remote repository">
|
|
|
|
<m:user-check user="${maven.username}"/>
|
|
<attainGoal name="jar:snapshot"/>
|
|
<property name="maven.jar.to.deploy" value="${maven.final.name}.jar"/>
|
|
<property name="dir" value="${maven.repo.central.directory}/${pom.artifactDirectory}/jars"/>
|
|
|
|
<util:replace var="jarToDeploy" oldChar="\" newChar="/">${maven.build.dir}/${maven.jar.to.deploy}</util:replace>
|
|
<util:replace var="forwardSlashBaseDir" oldChar="\" newChar="/" value="${basedir}"/>
|
|
<j:if test="${!forwardSlashBaseDir.endsWith('/')}">
|
|
<j:set var="base" value="${forwardSlashBaseDir}/" />
|
|
</j:if>
|
|
<j:set var="relativePath">${jarToDeploy.substring(base.length())}</j:set>
|
|
|
|
<deploy:artifact
|
|
artifact="${relativePath}"
|
|
type="jars"
|
|
assureDirectoryCommand="mkdir -p"
|
|
siteCommand="cd @deployDirectory@; chmod g+w ${maven.jar.to.deploy}; chgrp maven ${maven.jar.to.deploy}; ln -sf ${maven.jar.to.deploy} ${pom.artifactId}-SNAPSHOT.jar; echo ${snapshotVersion} > ${pom.artifactId}-snapshot-version"
|
|
/>
|
|
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- D E P L O Y J A R -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal
|
|
name="jar:deploy"
|
|
description="Deploy a jar to the remote repository">
|
|
|
|
<m:user-check user="${maven.username}"/>
|
|
<attainGoal name="java:jar"/>
|
|
<property name="maven.jar.to.deploy" value="${maven.final.name}.jar"/>
|
|
|
|
<j:set var="sl" value="/"/>
|
|
<util:replace var="jarToDeploy" oldChar="\" newChar="/">${maven.build.dir}/${maven.jar.to.deploy}</util:replace>
|
|
<util:replace var="forwardSlashBaseDir" oldChar="\" newChar="/" value="${basedir}"/>
|
|
<j:if test="${!forwardSlashBaseDir.endsWith('/')}">
|
|
<j:set var="base" value="${forwardSlashBaseDir}/" />
|
|
</j:if>
|
|
<j:set var="relativePath">${jarToDeploy.substring(base.length())}</j:set>
|
|
|
|
<deploy:artifact
|
|
artifact="${relativePath}"
|
|
type="jars"
|
|
assureDirectoryCommand="mkdir -p"
|
|
siteCommand="cd @deployDirectory@; chmod g+w ${maven.jar.to.deploy}; chgrp maven ${maven.jar.to.deploy}"
|
|
/>
|
|
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- I N S T A L L J A R -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal name="jar:install" prereqs="java:jar"
|
|
description="Install the jar in the local repository">
|
|
|
|
<echo>
|
|
id = '${pom.artifactId}'
|
|
groupId = '${pom.groupId}'
|
|
artifactDirectory = '${pom.artifactDirectory}'
|
|
</echo>
|
|
|
|
<property name="jardir__" value="${maven.repo.local}/${pom.artifactDirectory}/jars"/>
|
|
<mkdir dir="${jardir__}"/>
|
|
<copy
|
|
file="${maven.build.dir}/${maven.final.name}.jar"
|
|
todir="${jardir__}"
|
|
overwrite="true"
|
|
/>
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- I N S T A L L S N A P S H O T -->
|
|
<!-- ================================================================== -->
|
|
|
|
<goal
|
|
name="jar:install-snapshot" prereqs="jar:snapshot"
|
|
description="Install a snapshot jar in the local repository">
|
|
|
|
<property name="jardir__" value="${maven.repo.local}/${pom.artifactDirectory}/jars"/>
|
|
<mkdir dir="${jardir__}"/>
|
|
<copy
|
|
file="${maven.build.dir}/${maven.final.name}.jar"
|
|
tofile="${jardir__}/${pom.artifactId}-SNAPSHOT.jar"
|
|
overwrite="true"
|
|
/>
|
|
<copy
|
|
file="${maven.build.dir}/${maven.final.name}.jar"
|
|
tofile="${jardir__}/${maven.final.name}.jar"
|
|
/>
|
|
</goal>
|
|
|
|
<goal name="clean" description="Remove all project artifacts"
|
|
prereqs="clean:clean"/>
|
|
|
|
<goal name="clean:clean"
|
|
description="Remove all project artifacts">
|
|
<delete dir="${maven.build.dir}"/>
|
|
<delete file="${basedir}/velocity.log" quiet="true" failonerror="false"/>
|
|
</goal>
|
|
|
|
</project>
|