o trying out interactive pom editing.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112887 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f9906f9f3b
commit
6a171dc97f
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:i="jelly:interaction"
|
||||
xmlns:u="jelly:util"
|
||||
@ -30,8 +30,8 @@
|
||||
| what went into a specific version. Eventually it would also be nice to
|
||||
| trace back through the POMs so you could build any version of any
|
||||
| project from sources at any point in time.
|
||||
| Q: so how do we find the latest timestamped version.
|
||||
| A: when a snapshot is deployed we need a file with the real version
|
||||
| Q: so how do we find the latest timestamped version.
|
||||
| A: when a snapshot is deployed we need a file with the real version
|
||||
| of the latest snapshot.
|
||||
-->
|
||||
|
||||
@ -43,57 +43,57 @@
|
||||
|
|
||||
-->
|
||||
<goal name="convert-snapshots">
|
||||
|
||||
<r:convert-snapshot-dependencies
|
||||
|
||||
<r:resolve-snapshots
|
||||
transformer="transformer"
|
||||
transformations="transformations"/>
|
||||
|
||||
<i:ask
|
||||
<i:ask
|
||||
question="There are ${size(transformations)} snapshot dependencies, would you like to update them to use timestamped versions?"
|
||||
answer="answer"
|
||||
answer="answer"
|
||||
default="yes"/>
|
||||
|
||||
|
||||
<j:if test="${answer == 'yes'}">
|
||||
|
||||
|
||||
<j:forEach var="transformation" items="${transformations}"/>
|
||||
|
||||
|
||||
<!-- Display transformation info. Needs to be consumable by a GUI. -->
|
||||
|
||||
|
||||
<echo>
|
||||
${transformation.beforeTransformation}
|
||||
<echo>
|
||||
</echo>
|
||||
|
||||
<echo>
|
||||
${transformation.afterTransformation}
|
||||
<echo>
|
||||
</echo>
|
||||
|
||||
<i:ask
|
||||
<i:ask
|
||||
question="Do you want to update this dependency?"
|
||||
answer="answer"
|
||||
answer="answer"
|
||||
default="yes"/>
|
||||
|
||||
|
||||
<j:if test=${answer == 'yes'}">
|
||||
|
||||
|
||||
<!-- Change the node. -->
|
||||
<r:transform transformation="${transformation}"/>
|
||||
|
||||
|
||||
</j:if>
|
||||
|
||||
|
||||
</j:forEach>
|
||||
|
||||
<i:ask
|
||||
|
||||
<i:ask
|
||||
question="Would you like the update POM to be written out for the release?"
|
||||
answer="answer"
|
||||
answer="answer"
|
||||
default="yes"/>
|
||||
|
||||
|
||||
<j:if test=${answer == 'yes'}">
|
||||
<!-- Write out the pom. -->
|
||||
<r:write-pom/>
|
||||
${transformer.write()}
|
||||
</j:if>
|
||||
|
||||
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
|
||||
<!--
|
||||
|
|
||||
| Validate the POM for a release. This consists of:
|
||||
@ -102,15 +102,15 @@
|
||||
|
|
||||
-->
|
||||
<goal name="validate-pom-for-release">
|
||||
|
||||
|
||||
<j:useBean var="snapshots" class="java.util.ArrayList"/>
|
||||
|
||||
|
||||
<j:forEach var="dependency" items="${pom.dependencies}">
|
||||
<j:if test="${dependency.version == 'SNAPSHOT'}">
|
||||
<j:set var="dummy" value="${snapshots.add(dependency)}"/>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
|
||||
<j:if test="${size(snapshots) > 0}">
|
||||
<echo/>
|
||||
<echo>The following dependencies have SNAPSHOT identifiers:</echo>
|
||||
@ -121,19 +121,19 @@
|
||||
<fail message="">
|
||||
</fail>
|
||||
</j:if>
|
||||
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
<!--
|
||||
|
|
||||
| Release
|
||||
|
|
||||
-->
|
||||
<goal name="release">
|
||||
|
||||
|
||||
<attainGoal name="validate-pom-for-release"/>
|
||||
<attainGoal name="deploy:pom"/>
|
||||
|
||||
|
||||
<!--
|
||||
|
|
||||
| Build the binary and source distributions. We need to alter
|
||||
@ -141,7 +141,7 @@
|
||||
| deploy instead of having to build everything all the time.
|
||||
|
|
||||
-->
|
||||
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@ -71,6 +71,7 @@ import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This is the base class for any tool that attempts to transform fields
|
||||
@ -82,7 +83,7 @@ import java.util.Properties;
|
||||
*
|
||||
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
|
||||
*
|
||||
* @version $Id: AbstractPomTransformer.java,v 1.4 2003/02/11 01:00:55 jvanzyl Exp $
|
||||
* @version $Id: AbstractPomTransformer.java,v 1.5 2003/02/11 02:40:41 jvanzyl Exp $
|
||||
*/
|
||||
public abstract class AbstractPomTransformer
|
||||
implements PomTransformer
|
||||
@ -102,7 +103,7 @@ public abstract class AbstractPomTransformer
|
||||
/** Nodes selected for transformation using xpath. */
|
||||
private List selectedNodes;
|
||||
|
||||
private List transformations;
|
||||
private List transformations = new ArrayList();
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Accessors
|
||||
|
||||
@ -6,7 +6,7 @@ import org.apache.commons.jelly.tags.core.CoreTagLibrary;
|
||||
* Release tag library.
|
||||
*
|
||||
* @author <a href="jason@zenplex.com">Jason van Zyl</a>
|
||||
* @version $Id: ReleaseTagLibrary.java,v 1.1 2003/02/10 14:06:03 jvanzyl Exp $
|
||||
* @version $Id: ReleaseTagLibrary.java,v 1.2 2003/02/11 02:40:41 jvanzyl Exp $
|
||||
*/
|
||||
public class ReleaseTagLibrary
|
||||
extends CoreTagLibrary
|
||||
@ -17,5 +17,6 @@ public class ReleaseTagLibrary
|
||||
*/
|
||||
public ReleaseTagLibrary()
|
||||
{
|
||||
registerTag( "resolve-snapshots", ResolveSnapshotsTag.class );
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,106 @@
|
||||
package org.apache.maven.release.jelly;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache MavenSession" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache MavenSession", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import org.apache.commons.jelly.TagSupport;
|
||||
import org.apache.commons.jelly.XMLOutput;
|
||||
import org.apache.commons.jelly.JellyTagException;
|
||||
import org.apache.maven.release.SnapshotResolver;
|
||||
import org.apache.maven.project.Project;
|
||||
import org.apache.maven.MavenConstants;
|
||||
|
||||
public abstract class ResolveSnapshotsTag
|
||||
extends TagSupport
|
||||
{
|
||||
private SnapshotResolver snapshotResolver;
|
||||
|
||||
private String transformer;
|
||||
|
||||
private String transformations;
|
||||
|
||||
public void setTransformations( String transformations )
|
||||
{
|
||||
this.transformations = transformations;
|
||||
}
|
||||
|
||||
public String getTransformations()
|
||||
{
|
||||
return transformations;
|
||||
}
|
||||
|
||||
public void setTransformer( String transformer )
|
||||
{
|
||||
this.transformer = transformer;
|
||||
}
|
||||
|
||||
public String getTransformer()
|
||||
{
|
||||
return transformer;
|
||||
}
|
||||
|
||||
public void doTag( XMLOutput output )
|
||||
throws JellyTagException
|
||||
{
|
||||
Project project = (Project) context.getVariable( MavenConstants.MAVEN_POM );
|
||||
|
||||
snapshotResolver = new SnapshotResolver();
|
||||
snapshotResolver.setProject( project.getFile() );
|
||||
|
||||
context.setVariable( getTransformer(), snapshotResolver );
|
||||
context.setVariable( getTransformations(), snapshotResolver.getTransformations() );
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user