You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/02/10 16:44:41 UTC

cvs commit: jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release SnapshotResolver.java

jvanzyl     2003/02/10 07:44:40

  Modified:    src/plugins-build/release/src/main/org/apache/maven/release
                        SnapshotResolver.java
  Log:
  o use existing maven constants.
  
  Revision  Changes    Path
  1.2       +25 -28    jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/SnapshotResolver.java
  
  Index: SnapshotResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/SnapshotResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SnapshotResolver.java	10 Feb 2003 14:06:03 -0000	1.1
  +++ SnapshotResolver.java	10 Feb 2003 15:44:40 -0000	1.2
  @@ -56,17 +56,12 @@
    * ====================================================================
    */
   
  -import org.dom4j.Document;
  -import org.dom4j.Node;
  -import org.dom4j.io.SAXReader;
  -import org.jaxen.XPath;
  -import org.jaxen.dom4j.Dom4jXPath;
  -import org.apache.maven.util.HttpUtils;
   import org.apache.commons.io.FileUtils;
  +import org.apache.maven.util.HttpUtils;
  +import org.apache.maven.MavenConstants;
  +import org.dom4j.Node;
   
   import java.io.File;
  -import java.util.ArrayList;
  -import java.util.List;
   
   /**
    * This is a simple POM manipulator that doesn't take into account any sort of
  @@ -79,16 +74,6 @@
   public class SnapshotResolver
       extends AbstractPomTransformer
   {
  -    // ----------------------------------------------------------------------
  -    // Constants
  -    // ----------------------------------------------------------------------
  -
  -    public static final String PROXY_HOST = "";
  -    public static final String PROXY_PORT = "";
  -    public static final String PROXY_USER_NAME = "";
  -    public static final String PROXY_PASSWORD = "";
  -    public static final String REPO_REMOTE = "";
  -
       // -------------------------------------------------------------------------
       // Accessors
       // -------------------------------------------------------------------------
  @@ -102,17 +87,28 @@
           throws Exception
       {
           Node idNode = node.selectSingleNode( "id" );
  -        Node artifactIdNode = node.selectSingleNode( "artifactId" );
  -        Node groupIdNode = node.selectSingleNode( "groupId" );
  -        Node versionNode = node.selectSingleNode( "version" );
   
  -        String groupId = null;
  -        String artifactId = null;
  +        String groupId;
  +        String artifactId;
  +
  +        if ( idNode != null )
  +        {
  +            groupId = idNode.getText();
  +            artifactId = groupId;
  +        }
  +        else
  +        {
  +            Node artifactIdNode = node.selectSingleNode( "artifactId" );
  +            Node groupIdNode = node.selectSingleNode( "groupId" );
  +
  +            groupId = groupIdNode.getText();
  +            artifactId = artifactIdNode.getText();
  +        }
   
           // Now we need to attempt to find the the actual timestamp
           // version for this dependency.
   
  -        String url = getProperties().getProperty( REPO_REMOTE ) + "/" +
  +        String url = getProperties().getProperty( MavenConstants.REPO_REMOTE ) + "/" +
               groupId + "/jars/" + artifactId + "-snapshot-version";
   
           File snapshotVersionFile = new File( artifactId + "-snapshot-version" );
  @@ -123,10 +119,10 @@
                                  snapshotVersionFile,
                                  true, // ignore errors
                                  false, // use timestamps
  -                               getProperties().getProperty( PROXY_HOST ), // proxy host
  -                               getProperties().getProperty( PROXY_PORT ), // proxy port
  -                               getProperties().getProperty( PROXY_USER_NAME ), // proxy user name
  -                               getProperties().getProperty( PROXY_PASSWORD ) // proxy password
  +                               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
               );
           }
           catch ( Exception e )
  @@ -138,6 +134,7 @@
           if ( snapshotVersionFile.exists() )
           {
               String timestampVersion = FileUtils.fileRead( snapshotVersionFile.getPath() );
  +            Node versionNode = node.selectSingleNode( "version" );
               versionNode.setText( timestampVersion );
           }
       }