o incorporating Mauro Televi's patch to the release plugin, these
changes have been battle tested with DNA/Loom.
Mauro's comments are attached for posterity:
---
attached is a first crack that incorporates the release functionality
currently in DNA and Loom distribution modules.
Two types of distributions:
- bin: this requires user customisation - uses dependency properties to
assign a category to a dependency and via a property
Eg, maven.release.distribution.categories=shared:lib,tools:tools/lib
tells it to place any "shared" dependency in path lib/ and
"tools" dependendency in tools/lib.
User can postGoal release:setup-distribution-bin to add any further
content to distribution.
- src: uses SCM plugin out of a box :-) works quite well IMO.
distribution artifact names are customisable but default to
${maven.final.name}-[bin|src].[tar.gz|zip]
Patch has documentation updated - so feel free to browse,
and let me if too scarse or patch.
If you create an issue in jira I can also attach the patch to it.
(I'm not sure If I can create the issue myself on maven project)
Further work would include incorporating the wrapper exes for the
release,�� but perhaps that's better done via a separate plugin.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114219 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
582557428b
commit
4634ebc56c
3 files changed
+204
-1
No files matched your search
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:archive="release:archive"
|
||||
xmlns:define="jelly:define"
|
||||
xmlns:deploy="deploy"
|
||||
xmlns:maven="jelly:maven"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:i="jelly:interaction"
|
||||
xmlns:u="jelly:util"
|
||||
@@ -36,6 +41,64 @@
|
||||
| of the latest snapshot.
|
||||
-->
|
||||
|
||||
<!--
|
||||
| Archive taglib:
|
||||
| - copy-dependencies: copies dependencies for category groups
|
||||
| attributes: category, todir
|
||||
| - gzip: creates tar.gz distribution file
|
||||
| attributes: dir, name
|
||||
| - zip: creates zip distribution file
|
||||
| attributes: dir, name
|
||||
-->
|
||||
<define:taglib uri="release:archive">
|
||||
<define:tag name="copy-dependencies">
|
||||
<j:if test="${projectDescriptor != null}">
|
||||
<maven:pom var="pom" projectDescriptor="${projectDescriptor}"/>
|
||||
</j:if>
|
||||
|
||||
<j:set var="mavenRepoLocal" value='${context.getVariable("maven.repo.local")}'/>
|
||||
<j:forEach var="dependency" items="${pom.dependencies}">
|
||||
<j:if test='${category.equals(dependency.getProperty("category"))}'>
|
||||
<j:set var="addDependencies" value='true'/>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
<j:if test='${addDependencies == "true" }'>
|
||||
<ant:mkdir dir="${todir}"/>
|
||||
<ant:copy todir="${todir}" flatten="true">
|
||||
<ant:fileset dir="${mavenRepoLocal}">
|
||||
<j:forEach var="dependency" items="${pom.dependencies}">
|
||||
<j:if test='${category.equals(dependency.getProperty("category"))}'>
|
||||
<ant:include name="${dependency.artifactDirectory}/jars/${dependency.artifact}"/>
|
||||
<ant:include name="${dependency.artifactDirectory}/licenses/${dependency.artifactId}.license"/>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
</ant:fileset>
|
||||
</ant:copy>
|
||||
</j:if>
|
||||
</define:tag>
|
||||
<define:tag name="gzip">
|
||||
<ant:tar longfile="gnu" tarfile="${maven.build.dir}/${name}.tar">
|
||||
<ant:tarfileset dir="${dir}" prefix="${name}"/>
|
||||
</ant:tar>
|
||||
<ant:gzip zipfile="${maven.build.dir}/${name}.tar.gz"
|
||||
src="${maven.build.dir}/${name}.tar"/>
|
||||
<ant:delete file="${maven.build.dir}/${name}.tar"/>
|
||||
</define:tag>
|
||||
<define:tag name="zip">
|
||||
<ant:zip destfile="${maven.build.dir}/${name}.zip">
|
||||
<ant:zipfileset dir="${dir}" prefix="${name}"/>
|
||||
</ant:zip>
|
||||
</define:tag>
|
||||
<define:tag name="deploy">
|
||||
<deploy:artifact
|
||||
artifact="${maven.build.dir}/${name}"
|
||||
type="distributions"
|
||||
assureDirectoryCommand="mkdir -p"
|
||||
siteCommand="cd @deployDirectory@; chmod g+w ${name}; chgrp ${maven.remote.group} ${name}"/>
|
||||
</define:tag>
|
||||
</define:taglib>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Convert SNAPSHOT version identifiers to real snapshot versions.
|
||||
@@ -158,7 +221,75 @@
|
||||
| deploy instead of having to build everything all the time.
|
||||
|
|
||||
-->
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Initialise release variables
|
||||
|
|
||||
-->
|
||||
<goal name="release:init">
|
||||
<j:set var="releaseNameBin" value="${maven.release.name.bin}"/>
|
||||
<j:if test="${empty(releaseNameBin)}">
|
||||
<j:set var="releaseNameBin" value="${pom.artifactId}-${pom.currentVersion}-bin"/>
|
||||
</j:if>
|
||||
<j:set var="releaseNameSrc" value="${maven.release.name.src}"/>
|
||||
<j:if test="${empty(releaseNameSrc)}">
|
||||
<j:set var="releaseNameSrc" value="${pom.artifactId}-${pom.currentVersion}-src"/>
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Build a binary distribution copying dependencies according to
|
||||
| category groups.
|
||||
|
|
||||
-->
|
||||
<goal name="release:setup-distribution-bin" prereqs="release:init">
|
||||
<ant:mkdir dir="${maven.build.dir}/${releaseNameBin}"/>
|
||||
<u:tokenize var="categories" delim="," trim="true">${maven.release.distribution.categories}</u:tokenize>
|
||||
<j:forEach var="category" items="${categories}">
|
||||
<u:tokenize var="pair" delim=":" trim="true">${category}</u:tokenize>
|
||||
<j:set var="name" value="${pair.get(0)}"/>
|
||||
<j:set var="path" value="${pair.get(1)}"/>
|
||||
<archive:copy-dependencies category="${name}" todir="${maven.build.dir}/${releaseNameBin}/${path}"/>
|
||||
</j:forEach>
|
||||
</goal>
|
||||
|
||||
<goal name="release:build-distribution-bin" prereqs="release:setup-distribution-bin">
|
||||
<archive:gzip name="${releaseNameBin}" dir="${maven.build.dir}/${releaseNameBin}"/>
|
||||
<archive:zip name="${releaseNameBin}" dir="${maven.build.dir}/${releaseNameBin}"/>
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Build a source distribution from source repository.
|
||||
| Uses scm plugin to checkout project.
|
||||
|
|
||||
-->
|
||||
<goal name="release:build-distribution-src" prereqs="release:init,scm:checkout-project">
|
||||
<archive:gzip name="${releaseNameSrc}" dir="${maven.scm.checkout.dir}/${maven.scm.cvs.module}"/>
|
||||
<archive:zip name="${releaseNameSrc}" dir="${maven.scm.checkout.dir}/${maven.scm.cvs.module}"/>
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Deploy a binary distribution.
|
||||
|
|
||||
-->
|
||||
<goal name="release:deploy-distribution-bin" prereqs="release:build-distribution-bin">
|
||||
<archive:deploy name="${releaseNameBin}.tar.gz"/>
|
||||
<archive:deploy name="${releaseNameBin}.zip"/>
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Deploy a source distribution.
|
||||
|
|
||||
-->
|
||||
<goal name="release:deploy-distribution-src" prereqs="release:build-distribution-src">
|
||||
<archive:deploy name="${releaseNameSrc}.tar.gz"/>
|
||||
<archive:deploy name="${releaseNameSrc}.zip"/>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
@@ -26,6 +26,33 @@
|
||||
<description>
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>release:build-distribution-bin</name>
|
||||
<description>
|
||||
Builds binary distribution. Uses <code>maven.release.distribution.categories</code> property
|
||||
to separated dependencies in categories and corresponding distribution directories.
|
||||
Users can postGoal <code>release:setup-distribution-bin</code> with custom additional
|
||||
distribution content.
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>release:build-distribution-src</name>
|
||||
<description>
|
||||
Builds source distribution from source control using SCM plugin.
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>release:deploy-distribution-bin</name>
|
||||
<description>
|
||||
Deploys binary distribution built via <code>release:build-distribution-bin</code>
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>release:deploy-distribution-src</name>
|
||||
<description>
|
||||
Deploys source distribution built via <code>release:build-distribution-src</code>
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>validate-pom-for-release</name>
|
||||
<description>
|
||||
|
||||
@@ -6,7 +6,52 @@
|
||||
</properties>
|
||||
<body>
|
||||
<section name="Maven Release Plug-in Settings">
|
||||
<p>There are no settings to customize this plugin</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.release.name.bin</td>
|
||||
<td>Yes</td>
|
||||
<td>The name of the binary release file.
|
||||
Defaults to <code>${pom.artifactId}-${pom.currentVersion}-bin</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.release.name.src</td>
|
||||
<td>Yes</td>
|
||||
<td>The name of the source release file.
|
||||
Defaults to <code>${pom.artifactId}-${pom.currentVersion}-src</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.release.distribution.categories</td>
|
||||
<td>Yes</td>
|
||||
<td>The categories and relative paths of the dependencies to
|
||||
be included in the release. A list of category:path
|
||||
pairs, eg <code>shared:lib,tools:tools/lib</code>, where the
|
||||
category is set via dependency properties:
|
||||
<source><![CDATA[
|
||||
<dependency>
|
||||
<groupId>[groupId]</groupId>
|
||||
<artifactId>[artifactId]</artifactId>
|
||||
<version>[version]</version>
|
||||
<properties>
|
||||
<category>shared</category>
|
||||
</properties>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>[anotherGroupId]</groupId>
|
||||
<artifactId>[anotherArtifactId]</artifactId>
|
||||
<version>[anotherVersion]</version>
|
||||
<properties>
|
||||
<category>tools</category>
|
||||
</properties>
|
||||
</dependency>
|
||||
]]></source>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
Reference in new issue
Block a user