Author: brett
Date: Fri Jul 29 05:33:13 2005
New Revision: 226359

URL: http://svn.apache.org/viewcvs?rev=226359&view=rev
Log:
PR: MPARTIFACT-54, MPARTIFACT-55
- start 1.6, make it work with Maven 1.1 (and only Maven 1.1)
- fix file:// deployment bug


Modified:
    maven/maven-1/plugins/trunk/artifact/plugin.jelly
    maven/maven-1/plugins/trunk/artifact/project.xml
    
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java
    
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java
    
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
    
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
    
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
    
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
    
maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java
    maven/maven-1/plugins/trunk/artifact/xdocs/changes.xml

Modified: maven/maven-1/plugins/trunk/artifact/plugin.jelly
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/plugin.jelly?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/artifact/plugin.jelly Fri Jul 29 05:33:13 2005
@@ -28,6 +28,17 @@
   xmlns:deploy="deploy"
   >
 
+  <j:set var="version" value="${maven.application.version}" />
+  <j:if test="${version.compareTo('1.1') lt 0}">
+    <ant:fail>
+      Maven Artifact Plugin v${plugin.currentVersion} requires Maven 1.1 or 
above.
+      To correct this installation, remove:
+        
${maven.home}/plugins/maven-artifact-plugin-${plugin.currentVersion}.jar
+      and run:
+        maven plugin:download -DgroupId=maven 
-DartifactId=maven-artifact-plugin -Dversion=1.5.2
+    </ant:fail>
+  </j:if>
+
   
   <define:taglib uri="artifact">  
     

Modified: maven/maven-1/plugins/trunk/artifact/project.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/project.xml?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/project.xml (original)
+++ maven/maven-1/plugins/trunk/artifact/project.xml Fri Jul 29 05:33:13 2005
@@ -25,8 +25,8 @@
   <name>Maven Artifact Plugin</name>
   <!-- WARNING: some dependency checks will break if we get to 1.10, need to 
go to 2.0 from there -->
 
-  <currentVersion>1.5.2</currentVersion>
-  <description>Tools to manage artifacts and deployment.</description>
+  <currentVersion>1.6-SNAPSHOT</currentVersion>
+  <description>Tools to manage artifacts and deployment. Requires Maven 
1.1.</description>
   <shortDescription>Tools to manage artifacts and deployment</shortDescription>
   <url>http://maven.apache.org/reference/plugins/artifact/</url>
   
<issueTrackingUrl>http://jira.codehaus.org/browse/MPARTIFACT</issueTrackingUrl>
@@ -77,7 +77,7 @@
     <dependency>
       <groupId>maven</groupId>
       <artifactId>maven</artifactId>
-      <version>1.0</version>
+      <version>1.1-beta-1</version>
     </dependency>
     <dependency>
       <groupId>plexus</groupId>
@@ -85,16 +85,6 @@
       <version>1.0-alpha-3</version>
     </dependency>
     <dependency>
-      <groupId>commons-betwixt</groupId>
-      <artifactId>commons-betwixt</artifactId>
-      <version>1.0-beta-1.20030111.103454</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-digester</groupId>
-      <artifactId>commons-digester</artifactId>
-      <version>1.4.1</version>
-    </dependency>
-    <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
       <version>3.1</version>
@@ -105,11 +95,6 @@
       <version>1.6.1</version>
     </dependency>
     <dependency>
-      <groupId>dom4j</groupId>
-      <artifactId>dom4j</artifactId>
-      <version>1.4</version>
-    </dependency>
-    <dependency>
       <groupId>commons-net</groupId>
       <artifactId>commons-net</artifactId>
       <version>1.1.0</version>
@@ -177,7 +162,7 @@
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-file</artifactId>
-      <version>1.0-alpha-3</version>
+      <version>1.0-alpha-5-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>maven</groupId>
@@ -187,34 +172,14 @@
 
     <!-- For MavenUtils  -->
     <dependency>
-      <groupId>maven</groupId>
-      <artifactId>maven-jelly-tags</artifactId>
-      <version>1.0.1</version>
-    </dependency>
-    <dependency>
-      <groupId>werkz</groupId>
-      <artifactId>werkz</artifactId>
-      <version>20040426.222000</version>
-    </dependency>
-    <dependency>
       <groupId>commons-jelly</groupId>
       <artifactId>commons-jelly-tags-ant</artifactId>
-      <version>1.0</version>
+      <version>1.1</version>
     </dependency>
     <dependency>
       <groupId>commons-jexl</groupId>
       <artifactId>commons-jexl</artifactId>
       <version>1.0-beta-1</version>
-    </dependency>
-    <dependency>
-      <groupId>forehead</groupId>
-      <artifactId>forehead</artifactId>
-      <version>1.0-beta-5</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-grant</groupId>
-      <artifactId>commons-grant</artifactId>
-      <version>1.0-beta-4</version>
     </dependency>
   </dependencies>
   <build>

Modified: 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java
 (original)
+++ 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java
 Fri Jul 29 05:33:13 2005
@@ -16,9 +16,6 @@
  * limitations under the License.
  */
 
-import org.apache.commons.betwixt.XMLIntrospector;
-import org.apache.commons.betwixt.io.BeanWriter;
-import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper;
 import org.apache.commons.jelly.JellyContext;
 import org.apache.maven.MavenException;
 import org.apache.maven.MavenUtils;
@@ -29,19 +26,15 @@
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.project.Project;
 import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.StringReader;
 import java.lang.reflect.Method;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Properties;
 
 /**
  * Rewrite a full model for publishing. Inheritence and expression will have 
been resolved.
@@ -83,7 +76,7 @@
         Model model;
         try
         {
-            // Very gross, but in Maven 1.0 we can't get access, and we don't 
want initialize() called
+            // Very gross, but we don't want initialize() called
             // A future version should use use project.getModel() and 
serialize that
             Method m = MavenUtils.class.getDeclaredMethod( 
"getNonJellyProject", new Class[]{File.class,
                                                                                
              MavenJellyContext.class,
@@ -107,17 +100,7 @@
             for ( Iterator i = p.getDependencies().iterator(); i.hasNext(); )
             {
                 org.apache.maven.project.Dependency d = 
(org.apache.maven.project.Dependency) i.next();
-                Map properties;
-                try
-                {
-                    // Maven 1.0.2
-                    properties = (Map) d.getClass().getMethod( 
"resolvedProperties", new Class[] {}  ).invoke( d, null );
-                }
-                catch ( NoSuchMethodException e )
-                {
-                    // Maven 1.1
-                    properties = (Map) d.getClass().getMethod( 
"getProperties", new Class[] {}  ).invoke( d, null );
-                }
+                Map properties = d.getProperties();
                 if ( properties != null && !properties.isEmpty() )
                 {
                     depProperties.put( d.getId(), properties );
@@ -125,16 +108,7 @@
                 }
             }
 
-            ByteArrayOutputStream projectStream = new ByteArrayOutputStream();
-
-            BeanWriter beanWriter = new BeanWriter( projectStream );
-            beanWriter.setXMLIntrospector( createXMLIntrospector() );
-
-            beanWriter.enablePrettyPrint();
-            beanWriter.setWriteIDs( false );
-            beanWriter.write( p );
-
-            String asString = projectStream.toString( System.getProperty( 
"file.encoding" ) );
+            String asString = p.getProjectAsString();
 
             MavenXpp3Reader reader = new MavenXpp3Reader();
             model = reader.read( new StringReader( asString ) );
@@ -174,15 +148,4 @@
         }
         return model;
     }
-
-    private static XMLIntrospector createXMLIntrospector()
-    {
-        XMLIntrospector introspector = new XMLIntrospector();
-
-        introspector.setAttributesForPrimitives( false );
-        introspector.setElementNameMapper( new DecapitalizeNameMapper() );
-
-        return introspector;
-    }
-
 }

Modified: 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java
 (original)
+++ 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java
 Fri Jul 29 05:33:13 2005
@@ -50,7 +50,7 @@
      *          
      * @throws MavenException 
      */
-    public void deploy(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
+    void deploy(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
         throws MavenException;
 
     /**
@@ -60,11 +60,10 @@
      *     (like <code>war</code>, <code>jar</code>)
      * @param project The project which is a producer of the artifact
      * @param handler the type handler for the artifact
-     * @see ArtifactDeployer#deploy(String, String, Project)
-     * 
+     *
      * @throws MavenException
      */
-    public void deploySnapshot(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
+    void deploySnapshot(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
         throws MavenException;
 
     /**
@@ -76,7 +75,7 @@
      * @param handler the type handler for the artifact
      * @throws MavenException
      */
-    public void install(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
+    void install(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
         throws MavenException;
 
     /**
@@ -88,7 +87,7 @@
      * @param handler the type handler for the artifact
      * @throws MavenException
      */
-    public void installSnapshot(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
+    void installSnapshot(String artifact, String type, Project project, 
ArtifactTypeHandler handler)
         throws MavenException;
 }
 

Modified: 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
 (original)
+++ 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
 Fri Jul 29 05:33:13 2005
@@ -16,21 +16,12 @@
  * limitations under the License.
  */
 
-import org.apache.commons.betwixt.XMLIntrospector;
-import org.apache.commons.betwixt.io.BeanWriter;
-import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.maven.MavenConstants;
 import org.apache.maven.MavenException;
-import org.apache.maven.MavenUtils;
 import org.apache.maven.artifact.PomRewriter;
-import org.apache.maven.jelly.MavenJellyContext;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.project.Project;
 import org.apache.maven.repository.ArtifactTypeHandler;
 import org.apache.maven.repository.DefaultArtifactTypeHandler;
@@ -51,14 +42,9 @@
 import org.apache.maven.wagon.providers.sshext.ScpExternalWagon;
 import org.apache.maven.wagon.repository.Repository;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
-import java.io.StringReader;
-import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.security.NoSuchAlgorithmException;
 import java.text.DateFormat;
@@ -462,9 +448,6 @@
         }
     }
 
-    /**
-     * @return
-     */
     private String getSnapshotSignature()
     {
         DateFormat fmt = new SimpleDateFormat( SNAPSHOT_FORMAT );
@@ -472,10 +455,6 @@
         return fmt.format( new Date() );
     }
 
-    /**
-     * @param artifact
-     * @return
-     */
     private File getFileForArtifact( String artifact )
         throws MavenException
     {
@@ -500,11 +479,6 @@
 
     /**
      * Create a file which contains timestamp of the latetst snapshot
-     *
-     * @param snapshotVersion
-     * @param project
-     * @param type
-     * @return
      */
     private File createSnapshotVersionFile( File artifact, String 
snapshotVersion, Project project, String type )
         throws MavenException

Modified: 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
 (original)
+++ 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
 Fri Jul 29 05:33:13 2005
@@ -32,21 +32,18 @@
  */
 public class DeployBean
 {
-    ArtifactDeployer artifactDeployer = null;
+    private ArtifactDeployer artifactDeployer;
 
-    private Project project = null;
-    private String artifact = null;
-    private String type = null;
-    private ArtifactTypeHandler typeHandler = null;
+    private Project project;
+    private String artifact;
+    private String type;
+    private ArtifactTypeHandler typeHandler;
 
     public DeployBean()
     {  
         artifactDeployer = new DefaultArtifactDeployer();
     }
 
-    /**
-     * @return
-     */
     public ArtifactTypeHandler getTypeHandler()
     {
         return typeHandler;
@@ -60,9 +57,6 @@
         this.typeHandler = typeHandler;
     }
 
-    /**
-     * @return
-     */
     public String getArtifact()
     {
         return artifact;
@@ -76,9 +70,6 @@
         this.artifact = artifact;
     }
 
-    /**
-     * @return
-     */
     public Project getProject()
     {
         return project;
@@ -92,9 +83,6 @@
         this.project = project;
     }
 
-    /**
-     * @return
-     */
     public String getType()
     {
         return type;

Modified: 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
 (original)
+++ 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
 Fri Jul 29 05:33:13 2005
@@ -22,14 +22,12 @@
 import org.apache.maven.MavenException;
 import org.apache.maven.project.Project;
 import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.sshext.ScpExternalWagon;
 import org.apache.maven.wagon.providers.ftp.FtpWagon;
+import org.apache.maven.wagon.providers.sshext.ScpExternalWagon;
 import org.apache.maven.wagon.proxy.ProxyInfo;
 import org.apache.maven.wagon.repository.Repository;
 import org.apache.maven.wagon.repository.RepositoryPermissions;
 
-import java.net.MalformedURLException;
-
 /**
  * Perform mapping between project's properties and attributes of Wagon 
Repository class.
  *
@@ -52,6 +50,11 @@
         Repository repository = new Repository( id, url );
 
         String dir = (String) project.getContext().getVariable( "maven.repo." 
+ id + ".directory" );
+        if ( repository.getBasedir() != null )
+        {
+            dir = repository.getBasedir() + dir;
+        }
+
         repository.setBasedir( dir );
         if ( dir == null )
         {
@@ -173,10 +176,10 @@
     {
         ProxyInfo proxyInfo = new ProxyInfo();
 
-        String proxyHost = (String) project.getContext().getProxyHost();
-        String proxyUser = (String) project.getContext().getProxyUserName();
-        String proxyPassword = (String) 
project.getContext().getProxyPassword();
-        String proxyPort = (String) project.getContext().getProxyPort();
+        String proxyHost = project.getContext().getProxyHost();
+        String proxyUser = project.getContext().getProxyUserName();
+        String proxyPassword = project.getContext().getProxyPassword();
+        String proxyPort = project.getContext().getProxyPort();
 
         if ( proxyPort != null )
         {

Modified: 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
 (original)
+++ 
maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
 Fri Jul 29 05:33:13 2005
@@ -21,7 +21,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.maven.wagon.events.TransferEvent;
 import org.apache.maven.wagon.events.TransferListener;
-import org.apache.maven.util.BootstrapDownloadMeter;
 
 /**
  * Bootstrap download progress meter.
@@ -34,12 +33,14 @@
     /** log for debug output */
     private static final Log log = LogFactory.getLog(UploadMeter.class);
 
-    private int shownSoFar = 0;
+    private int shownSoFar;
     private final int numHashes;
     private final char hashChar;
-    private long complete = 0;
+    private long complete;
     private long total;
 
+    private static final int KB = 1024;
+
     public UploadMeter()
     {
         this( 20, '.' );
@@ -80,7 +81,7 @@
 
     public void transferCompleted( TransferEvent transferEvent )
     {
-        System.out.println(" (" + (total/1024) + "K)");
+        System.out.println(" (" + total / KB + "K)");
     }
 
     public void transferError( TransferEvent transferEvent )

Modified: 
maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java
 (original)
+++ 
maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java
 Fri Jul 29 05:33:13 2005
@@ -25,6 +25,7 @@
 import org.apache.maven.MavenConstants;
 
 import java.io.File;
+import java.io.FileReader;
 
 /**
  * Test the POM rewriter.
@@ -45,7 +46,7 @@
     }
 
     public void testPropertiesRewriting()
-        throws MavenException
+        throws Exception
     {
         String resourceName = "pom-with-properties.xml";
 

Modified: maven/maven-1/plugins/trunk/artifact/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/artifact/xdocs/changes.xml?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/artifact/xdocs/changes.xml Fri Jul 29 05:33:13 
2005
@@ -25,6 +25,10 @@
     <author email="[EMAIL PROTECTED]">Vincent Massol</author>
   </properties>
   <body>
+    <release version="1.6" date="in SVN">
+      <action dev="brett" type="fix" issue="MPARTIFACT-55">Correct basedir for 
file:// URLs</action>
+      <action dev="brett" type="fix" issue="MPARTIFACT-54">Fix handling of 
dependencies with properties</action>
+    </release>
     <release version="1.5.2" date="2005-06-15">
       <action dev="brett" type="fix" issue="MPARTIFACT-51">Correct the 
translation of dependency properties on deployment of the POM</action>
       <action dev="brett" type="fix" issue="MPARTIFACT-52">Upgrade Wagon SSH 
External provider to allow the use of no private key, and to correctly pass the 
private key and port arguments</action>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to