o I can now modify the POM interactively. Can't really view the XML that

well as jelly tries to escape everything. Gotta be a way around that.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112890 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jvanzyl committed 2003-02-11 03:25:49 +00:00
1 parent 6eb4994496
commit c4ed462856
4 files changed
+30 -17

No files matched your search

+2 -2
View File
@@ -49,7 +49,7 @@
transformations="transformations"/>
<i:ask
question="There are ${size(transformations)} snapshot dependencies, would you like to update them to use timestamped versions?"
question="There are ${transformer.selectedNodeCount} snapshot dependencies, would you like to update them to use timestamped versions?"
answer="answer"
default="yes"/>
@@ -75,7 +75,7 @@
<j:if test="${answer == 'yes'}">
<!-- Change the node. -->
<r:transform transformation="${transformation}"/>
${transformation.transform()}"/>
</j:if>
@@ -72,6 +72,7 @@ import java.util.List;
import java.util.Iterator;
import java.util.Properties;
import java.util.ArrayList;
import java.util.Map;
/**
* This is the base class for any tool that attempts to transform fields
@@ -83,7 +84,7 @@ import java.util.ArrayList;
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
*
* @version $Id: AbstractPomTransformer.java,v 1.5 2003/02/11 02:40:41 jvanzyl Exp $
* @version $Id: AbstractPomTransformer.java,v 1.6 2003/02/11 03:25:49 jvanzyl Exp $
*/
public abstract class AbstractPomTransformer
implements PomTransformer
@@ -98,12 +99,12 @@ public abstract class AbstractPomTransformer
private File outputFile;
/** Properties used in transformNode */
private Properties properties;
private Map variables;
/** Nodes selected for transformation using xpath. */
private List selectedNodes;
private List transformations = new ArrayList();
private List transformations;
// -------------------------------------------------------------------------
// Accessors
@@ -113,18 +114,18 @@ public abstract class AbstractPomTransformer
*
* @return
*/
public Properties getProperties()
public Map getVariables()
{
return properties;
return variables;
}
/**
*
* @param properties
* @param variables
*/
public void setProperties( Properties properties )
public void setVariables( Map variables )
{
this.properties = properties;
this.variables = variables;
}
/**
@@ -238,6 +239,8 @@ public abstract class AbstractPomTransformer
*/
public void createTransformations()
{
transformations = new ArrayList();
for ( Iterator i = getSelectedNodes().iterator(); i.hasNext(); )
{
Object o = i.next();
@@ -68,7 +68,7 @@ import java.io.File;
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
*
* @version $Id: SnapshotResolver.java,v 1.5 2003/02/11 00:56:36 jvanzyl Exp $
* @version $Id: SnapshotResolver.java,v 1.6 2003/02/11 03:25:49 jvanzyl Exp $
*/
public class SnapshotResolver
extends AbstractPomTransformer
@@ -114,8 +114,16 @@ public class SnapshotResolver
// Now we need to attempt to find the the actual timestamp
// version for this dependency.
String url = getProperties().getProperty( MavenConstants.REPO_REMOTE ) + "/" +
// Variables are being stored as ConstantExpressions ...
/*
String url = getVariables().get( MavenConstants.REPO_REMOTE ) + "/" +
groupId + "/jars/" + artifactId + "-snapshot-version";
*/
String url = "http://www.ibiblio.org/maven/" + groupId + "/jars/" + artifactId + "-snapshot-version";
System.out.println( "url: " + url );
File snapshotVersionFile = new File( artifactId + "-snapshot-version" );
@@ -125,16 +133,17 @@ public class SnapshotResolver
snapshotVersionFile,
true, // ignore errors
false, // use timestamps
getProperties().getProperty( MavenConstants.PROXY_HOST ), // proxy host
getProperties().getProperty( MavenConstants.PROXY_PORT ), // proxy port
getProperties().getProperty( MavenConstants.PROXY_USERNAME ), // proxy user name
getProperties().getProperty( MavenConstants.PROXY_PASSWORD ) // proxy password
(String) getVariables().get( MavenConstants.PROXY_HOST ), // proxy host
(String) getVariables().get( MavenConstants.PROXY_PORT ), // proxy port
(String) getVariables().get( MavenConstants.PROXY_USERNAME ), // proxy user name
(String) getVariables().get( MavenConstants.PROXY_PASSWORD ) // proxy password
);
}
catch ( Exception e )
{
// Either doesn't exist, or we have a network problem. In
// either event we can't update the version field.
System.out.println( "Can't retrieve snapshot version file: " + e.getLocalizedMessage() );
}
if ( snapshotVersionFile.exists() )
@@ -63,7 +63,7 @@ import org.apache.maven.release.SnapshotResolver;
import org.apache.maven.project.Project;
import org.apache.maven.MavenConstants;
public abstract class ResolveSnapshotsTag
public class ResolveSnapshotsTag
extends TagSupport
{
private SnapshotResolver snapshotResolver;
@@ -99,6 +99,7 @@ public abstract class ResolveSnapshotsTag
snapshotResolver = new SnapshotResolver();
snapshotResolver.setProject( project.getFile() );
snapshotResolver.setVariables( project.getContext().getVariables() );
context.setVariable( getTransformer(), snapshotResolver );
context.setVariable( getTransformations(), snapshotResolver.getTransformations() );