PR: MPARTIFACT-54, MPARTIFACT-55
- start 1.6, make it work with Maven 1.1 (and only Maven 1.1) - fix file:// deployment bug git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@226359 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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">
|
||||
|
||||
|
||||
@@ -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,23 +77,13 @@
|
||||
<dependency>
|
||||
<groupId>maven</groupId>
|
||||
<artifactId>maven</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<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>
|
||||
@@ -104,11 +94,6 @@
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<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>
|
||||
@@ -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>
|
||||
@@ -186,36 +171,16 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 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>
|
||||
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
|
||||
|
||||
@@ -16,9 +16,6 @@ package org.apache.maven.artifact;
|
||||
* 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.MavenXpp3Reader;
|
||||
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 @@ public class PomRewriter
|
||||
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 @@ public class PomRewriter
|
||||
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 @@ public class PomRewriter
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public class PomRewriter
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
private static XMLIntrospector createXMLIntrospector()
|
||||
{
|
||||
XMLIntrospector introspector = new XMLIntrospector();
|
||||
|
||||
introspector.setAttributesForPrimitives( false );
|
||||
introspector.setElementNameMapper( new DecapitalizeNameMapper() );
|
||||
|
||||
return introspector;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface ArtifactDeployer
|
||||
*
|
||||
* @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 @@ public interface ArtifactDeployer
|
||||
* (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 @@ public interface ArtifactDeployer
|
||||
* @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 @@ public interface ArtifactDeployer
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,21 +16,12 @@ package org.apache.maven.artifact.deployer;
|
||||
* 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.ssh.SftpWagon;
|
||||
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 @@ public class DefaultArtifactDeployer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private String getSnapshotSignature()
|
||||
{
|
||||
DateFormat fmt = new SimpleDateFormat( SNAPSHOT_FORMAT );
|
||||
@@ -472,10 +455,6 @@ public class DefaultArtifactDeployer
|
||||
return fmt.format( new Date() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param artifact
|
||||
* @return
|
||||
*/
|
||||
private File getFileForArtifact( String artifact )
|
||||
throws MavenException
|
||||
{
|
||||
@@ -500,11 +479,6 @@ public class DefaultArtifactDeployer
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -32,21 +32,18 @@ import org.apache.maven.repository.DefaultArtifactTypeHandler;
|
||||
*/
|
||||
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 @@ public class DeployBean
|
||||
this.typeHandler = typeHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getArtifact()
|
||||
{
|
||||
return artifact;
|
||||
@@ -76,9 +70,6 @@ public class DeployBean
|
||||
this.artifact = artifact;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Project getProject()
|
||||
{
|
||||
return project;
|
||||
@@ -92,9 +83,6 @@ public class DeployBean
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
|
||||
@@ -22,14 +22,12 @@ import org.apache.commons.logging.LogFactory;
|
||||
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 @@ public class RepositoryBuilder
|
||||
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 @@ public class RepositoryBuilder
|
||||
{
|
||||
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 )
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.apache.commons.logging.Log;
|
||||
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 @@ public class UploadMeter implements TransferListener
|
||||
/** 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 class UploadMeter implements TransferListener
|
||||
|
||||
public void transferCompleted( TransferEvent transferEvent )
|
||||
{
|
||||
System.out.println(" (" + (total/1024) + "K)");
|
||||
System.out.println(" (" + total / KB + "K)");
|
||||
}
|
||||
|
||||
public void transferError( TransferEvent transferEvent )
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.apache.maven.MavenUtils;
|
||||
import org.apache.maven.MavenConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
|
||||
/**
|
||||
* Test the POM rewriter.
|
||||
@@ -45,7 +46,7 @@ public class PomRewriterTest
|
||||
}
|
||||
|
||||
public void testPropertiesRewriting()
|
||||
throws MavenException
|
||||
throws Exception
|
||||
{
|
||||
String resourceName = "pom-with-properties.xml";
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
<author email="vmassol@apache.org">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>
|
||||
|
||||
Reference in New Issue
Block a user