rewritten gump plugin

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116285 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett 2004-12-10 12:18:15 +00:00
parent 0d92814363
commit 199a6844d1
7 changed files with 185 additions and 319 deletions

View File

@ -17,12 +17,13 @@
*/ */
--> -->
<project <project
xmlns:multiproject="multiproject"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define" xmlns:define="jelly:define"
xmlns:gump="gump"
xmlns:maven="jelly:maven" xmlns:maven="jelly:maven"
xmlns:j="jelly:core" xmlns:j="jelly:core"
xmlns:x="jelly:xml"
xmlns:u="jelly:util"> xmlns:u="jelly:util">
<!-- ================================================================== --> <!-- ================================================================== -->
@ -36,98 +37,67 @@
<!-- ================================================================== --> <!-- ================================================================== -->
<goal name="gump" <goal name="gump"
description="Generate Gump descriptor from Maven descriptor" description="Generate Gump descriptor from Maven descriptor"
prereqs="gump:generate-descriptor"/> prereqs="gump:gump" />
<goal name="gump:gump"
description="Generate Gump descriptor from Maven descriptor"
prereqs="gump:generate-descriptor"/>
<define:taglib uri="gump">
<define:tag name="name" trim="yes">
<u:properties var="map" file="${plugin.resources}/maven2gump.properties" />
<j:set var="gumpName" value="${map.getProperty(project)}" />
<j:if test="${empty(gumpName)}">${project}</j:if>
<j:if test="${!empty(gumpName)}">${gumpName}</j:if>
</define:tag>
</define:taglib>
<goal name="gump:generate-descriptor" <goal name="gump:generate-descriptor"
description="Generate Gump descriptor from Maven descriptor"> description="Generate Gump descriptor from Maven descriptor"
prereqs="gump:init">
<j:new var="reactorProjects" className="java.util.ArrayList" />
<j:set var="dummy" value="${reactorProjects.add(pom)}" />
<j:set var="goal" value="gump:gump" />
<ant:echo>Generating ${maven.gump.descriptor}...</ant:echo>
<j:import file="${plugin.resources}/module.jelly" inherit="true" />
</goal>
<goal name="gump:init">
<j:set var="genAnt" value="${maven.gump.ant.generate}" /> <j:set var="genAnt" value="${maven.gump.ant.generate}" />
<j:set var="genMaven" value="${maven.gump.maven.generate}" /> <j:set var="genMaven" value="${maven.gump.maven.generate}" />
<j:if test="${!genAnt and !genMaven}"> <j:if test="${!genAnt and !genMaven}">
<fail>You must specify one of maven.gump.ant and maven.gump.maven</fail> <fail>You must specify one of maven.gump.ant and maven.gump.maven</fail>
</j:if> </j:if>
<j:set var="gumpProject"><gump:name project="${pom.artifactId}"/></j:set> <u:tokenize var="scmTokens" delim=":">${pom.repository.connection}</u:tokenize>
<j:file name="${basedir}/gump.xml" prettyPrint="true" xmlns="dummy"> <j:choose>
<module name="${gumpProject}"> <j:when test="${scmTokens[1] == 'cvs'}">
<j:set var="moduleName" value="${scmTokens[5]}"/>
<description>${pom.shortDescription}</description> </j:when>
<url href="${pom.url}"/> <j:when test="${scmTokens[1] == 'svn'}">
<j:set var="moduleName" value="${scmTokens[4]}"/>
<u:tokenize var="scmTokens" delim=":">${pom.repository.connection}</u:tokenize> </j:when>
<cvs repository="${pom.gumpRepositoryId}" <j:otherwise>
module="${scmTokens[5]}" /> <ant:echo>Unknown SCM type ${scmTokens[1]}: you may need to manually add the repository</ant:echo>
</j:otherwise>
<!-- This is really the cvs module. We need to change this but --> </j:choose>
<!-- I will leave this for now until everything works. -->
<project name="${gumpProject}">
<!-- Standard Maven target to produce Javadocs, source -->
<!-- and binary distributions. -->
<j:if test="${genAnt}">
<ant buildfile="build.xml" target="${maven.gump.ant.target}">
<property name="final.name" value="${pom.artifactId}-@@DATE@@"/>
</ant>
</j:if>
<j:if test="${genMaven}">
<maven goal="${maven.gump.maven.goals}">
<property name="final.name" value="${pom.artifactId}-@@DATE@@"/>
</maven>
</j:if>
<package>${pom.package}</package>
<j:new var="dependentProjects" className="java.util.TreeSet" />
<!-- All Maven projects need Ant and Xerces to build. -->
<j:set var="dummy" value="${dependentProjects.add('jakarta-ant')}" />
<j:set var="dummy" value="${dependentProjects.add('xml-xerces')}"/>
<!--
Add project dependencies to the set, using project Id only
If there is a gump project mapping for the named maven
dependency, use that for the project in the depend tag
otherwise just use the project id
-->
<j:forEach var="dependency" items="${pom.dependencies}">
<j:set var="gumpDepName"><gump:name project="${dependency.groupId}" /></j:set>
<j:set var="dummy">${dependentProjects.add(gumpDepName)}</j:set>
</j:forEach>
<!-- dump out the set of dependencies -->
<j:forEach var="dependency" items="${dependentProjects}">
<depend project="${dependency}" />
</j:forEach>
<maven:makeRelativePath basedir="${basedir}" var="mavenBuildDest" separator="/" path="${maven.build.dest}" />
<work nested="${mavenBuildDest}"/>
<maven:makeRelativePath basedir="${basedir}" var="mavenBuildDir" separator="/" path="${maven.build.dir}" />
<home nested="${mavenBuildDir}"/>
<jar name="${pom.artifactId}-@@DATE@@.jar"/>
<u:tokenize var="moduleTokens" delim="/">${scmTokens[5]}</u:tokenize>
<maven:makeRelativePath basedir="${basedir}" var="mavenDocsDest" separator="/" path="${maven.docs.dest}" />
<javadoc nested="${mavenDocsDest}/apidocs" module="${moduleTokens[0]}"/>
<nag from="${pom.artifactId} development &lt;${pom.build.nagEmailAddress}&gt;"
to="${pom.build.nagEmailAddress}"/>
</project>
</module>
</j:file>
</goal> </goal>
<multiproject:dependency-handle />
<goal name="gump:multiproject"
description="Generate a single gump descriptor for a set of Maven projects"
prereqs="gump:init">
<maven:get plugin="maven-multiproject-plugin" property="maven.multiproject.includes" var="includes" />
<maven:get plugin="maven-multiproject-plugin" property="maven.multiproject.excludes" var="excludes" />
<maven:reactor
basedir="${basedir}"
banner="Generating gump descriptor for:"
includes="${includes}"
excludes="${excludes}"
postProcessing="true"
ignoreFailures="true"/>
<j:set var="goal" value="gump:multiproject" />
<ant:echo>Generating ${maven.gump.descriptor}...</ant:echo>
<j:import file="${plugin.resources}/module.jelly" inherit="true" />
</goal>
</project> </project>

View File

@ -18,4 +18,6 @@ maven.gump.ant.generate = false
maven.gump.maven.generate = true maven.gump.maven.generate = true
maven.gump.ant.target = dist maven.gump.ant.target = dist
maven.gump.maven.goals = jar maven.gump.maven.goals=jar
maven.gump.descriptor=${basedir}/gump.xml

View File

@ -23,7 +23,7 @@
<pomVersion>3</pomVersion> <pomVersion>3</pomVersion>
<id>maven-gump-plugin</id> <id>maven-gump-plugin</id>
<name>Maven Gump Plug-in</name> <name>Maven Gump Plug-in</name>
<currentVersion>1.4</currentVersion> <currentVersion>2.0-SNAPSHOT</currentVersion>
<description/> <description/>
<shortDescription>produce Gump descriptor</shortDescription> <shortDescription>produce Gump descriptor</shortDescription>
<url>http://maven.apache.org/reference/plugins/gump/</url> <url>http://maven.apache.org/reference/plugins/gump/</url>

View File

@ -1,232 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 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.
# -------------------------------------------------------------------
# This file was hand edited from:
# http://www.ibiblio.org/maven/
# and
# http://cvs.apache.org/builds/gump/latest/bypackage.html
#
#aelfred - not built by gump
#ant-contrib - same name
ant=jakarta-ant
antlr=antlr.runtime
#anttex - not built by gump
#aptconvert - not built by gump
#aspectj - same
#avalon-apps - not built by gump
avalon-cornerstone=jakarta-avalon-cornerstone
avalon-framework=jakarta-avalon
avalon-phoenix=jakarta-avalon-phoenix
#axion - not built by gump
axis=xml-axis
batik=xml-batik
bcel=jakarta-bcel
#blissed - not built by gump
bouncycastle=jce
bsf=bsf
bsh=beanshell
cactus=jakarta-cactus-framework13
#castor - same
#checkstyle - same
#classworlds - not built by gump
#clover - not built by gump
#commons-beanutils - same
#commons-betwixt - same
#commons-cli - same
#commons-codec - same
#commons-collections - same
#commons-configuration - not built by gump
#commons-daemon - not built by gump
#commons-dbcp - same
#commons-digester - same
#commons-discovery - same
#commons-email - same
#commons-fileupload - same
#commons-grant - same
#commons-graph - same
#commons-http - same
#commons-httpclient - same
#commons-io - same
#commons-jdbc2pool - not built by gump
#commons-jelly - same
#commons-jexl - same
#commons-jxpath - same
#commons-lang - same
#commons-latka - same
#commons-logging - same
#commons-messenger - same
#commons-modeler - same
#commons-net - same
#commons-pool - same
#commons-resources - same
#commons-sql - not built by gump
#commons-threadpool - not built by gump
#commons-util - same
#commons-xo - not built by gump
#concurrent - same
crimson=xml-crimson
#crossdb - not built by gump
#cryptix - not built by gump
#dom4j - same
#drools - not built by gump
#easymock - not built by gump
ecs=jakarta-ecs
#ejb - not built by gump
#excalibur-altrmi - same
#excalibur-collections - not built by gump
#excalibur-component - not built by gup
#excalibur-concurrent - same
#excalibur-configuration - not build by gump
#excalibur-containerkit - not built by gump
#excalibur-event - same
#excalibur-fortress - not built by gump
#excalibur-i18n - same
excalibur-instrument-manager-interfaces=excalibur-instrument-manager
excalibur-instrument-manager=excalibur-instrument-manager
#excalibur-instrument - same
#excalibur-io - same
#excalibur-logger - same
#excalibur-monitor - not built by gump
#excalibur-mpool - not built by gump
#excalibur-pool - same
#excalibur-sourceresolve - not built by gump
#excalibur-thread - same
#excalibur-util - same
#fesi - same
flux=jakarta-turbine-flux
fop=xml-fop
#forehead - same
#freebxml- not built by gump
#freemarker - same
fulcrum=jakarta-turbine-fulcrum
#genjar - not built by gump
#gnu-regexp - not built by gump
#graphlayout - not built by gump
#hibernate - not built by gump
#hsqldb - same
#httpunit - same
isorelax=iso-relax
#jaf - same
#jalopy-ant - not built by gump
#jalopy - not built by gump
#java2html - not built by gump
#javacc - same
#javadoc - not built by gump
#javagroups - same
#javamail - same
#jaxen - same
#jaxm - same
#jaxp - same
#jaxrpc - same
#jboss - not built by gump
#jca - not built by gump
#jcifs - same
#jcommon - not built by gump
#jcs-javagroups - not built by gump
jcs=jakarta-turbine-jcs
#jdbc - same
#jdbm - not built by gump
#jdepend - not built by gump
#jdiff - not built by gump
#jdo - same
#jdom - same
#jdring - not built by gump
#jetty - same
#jfreechart - not built by gump
#jgen - same
#jgraph - not built by gump
#jisp - not built by gump
#jms - same
#jndi - same
#jsr94 - not built by gump
#jsse - same
#jstl - not built by gump
#jstyle - not built by gump
#jta - same
#jtidy - same
#junit-doclet - not built by gump
#junit - same
#junitperf - not built by gump
#jython - same
#ldapsdk - same
log4j=jakarta-log4j
logkit=jakarta-avalon-logkit
#maven - same
#mckoi - not built by gump
#mm.mysql - not built by gump
#mockobjects - same
#msv - same
#mx4j - same
#nekohtml - same
#nsuml - same
#ognl - not built by gump
ojb=jakarta-ojb
oro=jakarta-oro
#p6spy - not built by gump
#patterntesting - not built by gump
#petridish - not built by gump
#piccolo - not built by gump
#plexus - not built by gump
poi=jakarta-poi
#postgresql - not built by gump
pull-parser=xpp
#qdox - not built by gump
#quartz - same
regexp=jakarta-regexp
relaxngDatatype=relaxng
#saaj - not built by gump
sax=xml-apis
#saxpath - not built by gump
servletapi=jakarta-servletapi
soap=xml-soap
#spirit-cache - no jars deployed
#statcvs - not built by gump
stratum=jakarta-turbine-stratum
#struts-menu - not built by gump
struts=jakarta-struts
#strutstestcase - not built by gump
#swt - same
# taglibs holds multiple jars, and multiple 'projects' in gump
taglibs=jakarta-taglibs-standard
#tapestry - not built by gump
#textarea - not built by gump
tomcat-util=jakarta-tomcat-util
tomcat=jakarta-tomcat
torque=jakarta-turbine-torque
#touchstone - not built by gump (a maven project)
turbine=jakarta-turbine
#tyrex - not built by gump
#vdoclet - not built by gump
velocity-dvsl=jakarta-velocity-dvsl
velocity=jakarta-velocity
#village - same
#webmacro - same
#webtest - not built by gump
werken-xpath=werken.xpath
#werkflow - not built by gump
#werkz - same
which=xml-commons-which
#wsdl4j - same
xalan=xml-xalan2
#xdoclet - same
xerces=xml-xerces2
#xml-apis- same
#xml-rpc - old name
#xml-security - same
#xmlrpc-helma - not built by gump
xmlrpc=xml-rpc
#xmlunit - same
#xsdlib - not built by gump

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 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.
*/
-->
<j:file name="${maven.gump.descriptor}"
prettyPrint="true"
xmlns:j="jelly:core"
xmlns:x="jelly:xml"
xmlns="dummy">
<!-- This should probably be pom.groupId, except I think module may need to be unique in gump space -->
<module name="${pom.artifactId}">
<j:whitespace><x:comment>
- This descriptor was automatically generated using Maven.
- To regenerate, run: "maven ${goal}"
-
- If you have a requirement that leads to hand editing, please consider filing
- a feature request at ${plugin.issueTrackingUrl}
</x:comment></j:whitespace>
<description>${pom.shortDescription}</description>
<url href="${pom.url}"/>
<j:choose>
<j:when test="${scmTokens[1] == 'cvs'}">
<cvs repository="${pom.gumpRepositoryId}" module="${moduleName}" />
</j:when>
<j:when test="${scmTokens[1] == 'svn'}">
<svn repository="${pom.gumpRepositoryId}" dir="${moduleName}" />
</j:when>
<!-- this field has already been validated to ensure there isn't something missing here -->
</j:choose>
<j:forEach var="project" items="${reactorProjects}">
<j:import file="${plugin.resources}/project.jelly" inherit="true" />
</j:forEach>
</module>
</j:file>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 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.
*/
-->
<!-- Note: all variables must be relative to the project, or from the project context -->
<j:whitespace
xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:u="jelly:util"
xmlns:license="license"
xmlns="dummy">
<project name="${project.artifactId}">
<maven:makeRelativePath basedir="${basedir}" var="homeDir" separator="/" path="${project.file.parent}" />
<j:if test="${genAnt}">
<ant buildfile="build.xml" target="${maven.gump.ant.target}">
<property name="final.name" value="${project.artifactId}-@@DATE@@"/>
</ant>
</j:if>
<j:if test="${genMaven}">
<maven goal="${maven.gump.maven.goals}" basedir="${homeDir}">
<property name="maven.final.name" value="${project.artifactId}-@@DATE@@"/>
</maven>
</j:if>
<j:forEach var="dep" items="${project.dependencies}">
<j:set var="projectId" value="${dep.artifactId}"/>
<j:if test="${dep.getProperty('gump.project') != null}">
<j:set var="projectId" value="${dep.getProperty('gump.project')}"/>
</j:if>
<depend project="${projectId}" />
</j:forEach>
<home nested="${homeDir}" />
<maven:makeRelativePath basedir="${project.file.parent}" var="mavenBuildDir" separator="/" path="${project.context.getVariable('maven.build.dir')}" />
<jar name="${mavenBuildDir}/${project.artifactId}-@@DATE@@.jar" />
<maven:makeRelativePath basedir="${basedir}" var="mavenDocsDest" separator="/" path="${project.context.getVariable('maven.docs.dest')}" />
<javadoc nested="${mavenDocsDest}/apidocs" />
<!-- As the test reports is a plugin property, we can't reliably get it from the project context.
Forced to assume the default -->
<maven:get var="testReportsDirectory" plugin="maven-test-plugin" property="maven.test.reportsDirectory" />
<maven:makeRelativePath basedir="${basedir}" var="mavenTestReportsDest" separator="/" path="${testReportsDirectory}" />
<junitreport nested="${homeDir}/${mavenTestReportsDest}" />
<nag from="${project.artifactId} development &lt;${project.build.nagEmailAddress}&gt;"
to="${project.build.nagEmailAddress}"/>
</project>
</j:whitespace>

View File

@ -24,6 +24,14 @@
<author email="dion@multitask.com.au">dIon Gillard</author> <author email="dion@multitask.com.au">dIon Gillard</author>
</properties> </properties>
<body> <body>
<release version="2.0-SNAPSHOT" date="in CVS">
<action dev="brett" type="add">Add junitreport element to the descriptor</action>
<action dev="brett" type="add">Add multiproject module for generating a single module with several projects within the one descriptor.</action>
<action dev="brett" type="fix">Set maven.final.name as a property for the &lt;maven element, instead of final.name</action>
<action dev="brett" type="fix">Set &lt;home to ${basedir} instead of ${maven.build.dir}, and set jar path relative to that</action>
<action dev="brett" type="update">Stop mapping Maven names to gump names inside the plugin, but allow the project to do this for itself</action>
<action dev="brett" type="add">Handle subversion as an SCM type</action>
</release>
<release version="1.4" date="2004-07-10"> <release version="1.4" date="2004-07-10">
<action dev="brett" type="add" issue="MPGUMP-1">Allow creation of &lt;maven descriptor element, and default to it</action> <action dev="brett" type="add" issue="MPGUMP-1">Allow creation of &lt;maven descriptor element, and default to it</action>
<action dev="brett" type="add">Add maven.gump.ant.target and maven.gump.maven.goal properties</action> <action dev="brett" type="add">Add maven.gump.ant.target and maven.gump.maven.goal properties</action>