diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java index 378f42bfa1..4e062e6178 100755 --- a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java +++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java @@ -68,7 +68,7 @@ public class DeployTask { if ( !isPomArtifact ) { - deployer.deploy( pom.getBuild().getDirectory(), artifact, deploymentRepository, localRepo ); + deployer.deploy( file, artifact, deploymentRepository, localRepo ); } else { diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java index 7ccd20df16..45e73769bd 100755 --- a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java +++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java @@ -64,7 +64,7 @@ public class InstallTask { if ( !isPomArtifact ) { - installer.install( pom.getBuild().getDirectory(), artifact, localRepo ); + installer.install( file, artifact, localRepo ); } else { diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java b/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java index d158166ae6..5bd3e4faad 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java @@ -25,7 +25,7 @@ public interface ArtifactDeployer { String ROLE = ArtifactDeployer.class.getName(); - void deploy( String basedir, Artifact artifact, ArtifactRepository deploymentRepository, + void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) throws ArtifactDeploymentException; diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java index 950bbc1f78..762427ca21 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -26,6 +26,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException; import org.apache.maven.artifact.transform.ArtifactTransformation; import org.apache.maven.wagon.TransferFailedException; +import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.util.FileUtils; import java.io.File; @@ -34,6 +35,7 @@ import java.util.Iterator; import java.util.List; public class DefaultArtifactDeployer + extends AbstractLogEnabled implements ArtifactDeployer { private WagonManager wagonManager; @@ -42,7 +44,7 @@ public class DefaultArtifactDeployer private List artifactTransformations; - public void deploy( String basedir, Artifact artifact, ArtifactRepository deploymentRepository, + public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) throws ArtifactDeploymentException { @@ -50,7 +52,8 @@ public class DefaultArtifactDeployer try { - source = artifactHandlerManager.getArtifactHandler( artifact.getType() ).source( basedir, artifact ); + String extension = artifactHandlerManager.getArtifactHandler( artifact.getType() ).extension(); + source = new File( basedir, finalName + "." + extension ); } catch ( ArtifactHandlerNotFoundException e ) { @@ -64,6 +67,12 @@ public class DefaultArtifactDeployer ArtifactRepository localRepository ) throws ArtifactDeploymentException { + if ( deploymentRepository.getAuthenticationInfo() == null ) + { + getLogger().warn( "Deployment repository {id: \'" + deploymentRepository.getId() + + "\'} has no associated authentication info!" ); + } + try { // TODO: better to have a transform manager, or reuse the handler manager again so we don't have these requirements duplicated all over? diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/AbstractArtifactHandler.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/AbstractArtifactHandler.java index 6b547797e0..98316f98b7 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/AbstractArtifactHandler.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/AbstractArtifactHandler.java @@ -16,10 +16,6 @@ package org.apache.maven.artifact.handler; * limitations under the License. */ -import org.apache.maven.artifact.Artifact; - -import java.io.File; - /** * @todo these should be configurable * @author Jason van Zyl @@ -33,11 +29,6 @@ public abstract class AbstractArtifactHandler return null; } - public File source( String basedir, Artifact artifact ) - { - return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + extension() ); - } - public String extension() { return "jar"; diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java index 094d1a1204..a0b4db801c 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java @@ -16,10 +16,6 @@ package org.apache.maven.artifact.handler; * limitations under the License. */ -import org.apache.maven.artifact.Artifact; - -import java.io.File; - /** * @author Jason van Zyl * @version $Id$ @@ -28,8 +24,6 @@ public interface ArtifactHandler { static String ROLE = ArtifactHandler.class.getName(); - File source( String basedir, Artifact artifact ); - String extension(); String directory(); diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/JavadocHandler.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/JavadocHandler.java index ef6c4604d3..3a00cc530f 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/JavadocHandler.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/JavadocHandler.java @@ -16,10 +16,6 @@ package org.apache.maven.artifact.handler; * limitations under the License. */ -import org.apache.maven.artifact.Artifact; - -import java.io.File; - /** * @author Carlos Sanchez * @version $Id$ @@ -27,10 +23,6 @@ import java.io.File; public class JavadocHandler extends AbstractArtifactHandler { - public File source( String basedir, Artifact artifact ) - { - return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "-javadocs." + extension() ); - } public String extension() { diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/SourceHandler.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/SourceHandler.java index 016952c364..66ce0c8286 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/SourceHandler.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/SourceHandler.java @@ -16,10 +16,6 @@ package org.apache.maven.artifact.handler; * limitations under the License. */ -import org.apache.maven.artifact.Artifact; - -import java.io.File; - /** * @author Trygve Laugstøl * @version $Id$ @@ -27,10 +23,6 @@ import java.io.File; public class SourceHandler extends AbstractArtifactHandler { - public File source( String basedir, Artifact artifact ) - { - return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "-sources." + extension() ); - } public String extension() { diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java b/maven-artifact/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java index 47f277d4bb..4a0d362614 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java @@ -34,11 +34,12 @@ public interface ArtifactInstaller * of the source file. * * @param basedir the directory where the artifact is stored + * @param finalName the name of the artifact sans extension * @param artifact the artifact definition * @param localRepository the local repository to install into * @throws ArtifactInstallationException if an error occurred installing the artifact */ - void install( String basedir, Artifact artifact, ArtifactRepository localRepository ) + void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository ) throws ArtifactInstallationException; diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java b/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java index db5ac2a196..b949c9bdfa 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java @@ -40,14 +40,15 @@ public class DefaultArtifactInstaller private List artifactTransformations; - public void install( String basedir, Artifact artifact, ArtifactRepository localRepository ) + public void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository ) throws ArtifactInstallationException { File source = null; try { - source = artifactHandlerManager.getArtifactHandler( artifact.getType() ).source( basedir, artifact ); + String extension = artifactHandlerManager.getArtifactHandler( artifact.getType() ).extension(); + source = new File( basedir, finalName + "." + extension ); } catch ( ArtifactHandlerNotFoundException e ) { diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java index 57f88f05ef..7d0635afd7 100644 --- a/maven-artifact/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java +++ b/maven-artifact/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java @@ -50,7 +50,7 @@ public class ArtifactDeployerTest Artifact artifact = createArtifact( "artifact", "1.0" ); - artifactDeployer.deploy( artifactBasedir, artifact, remoteRepository(), localRepository() ); + artifactDeployer.deploy( artifactBasedir, "artifact-1.0", artifact, remoteRepository(), localRepository() ); assertRemoteArtifactPresent( artifact ); } diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java index 45a8899e44..47105364dd 100644 --- a/maven-artifact/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java +++ b/maven-artifact/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java @@ -50,7 +50,7 @@ public class ArtifactInstallerTest Artifact artifact = createArtifact( "artifact", "1.0" ); - artifactInstaller.install( artifactBasedir, artifact, localRepository() ); + artifactInstaller.install( artifactBasedir, "artifact-1.0", artifact, localRepository() ); assertLocalArtifactPresent( artifact ); } diff --git a/maven-plugins/maven-deploy-plugin/pom.xml b/maven-plugins/maven-deploy-plugin/pom.xml index aa7af2c40f..7b6b5f62a1 100644 --- a/maven-plugins/maven-deploy-plugin/pom.xml +++ b/maven-plugins/maven-deploy-plugin/pom.xml @@ -19,18 +19,18 @@ org.apache.maven maven-artifact - 2.0-alpha-1 + 2.0-SNAPSHOT org.apache.maven.wagon wagon-file - 1.0-alpha-2 + 1.0-alpha-3-SNAPSHOT runtime org.apache.maven.wagon wagon-ssh - 1.0-alpha-2 + 1.0-alpha-3-SNAPSHOT runtime diff --git a/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java b/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java index 81b94c78fe..8d402e78d7 100644 --- a/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java +++ b/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java @@ -80,13 +80,6 @@ public class DeployMojo throw new PluginExecutionException( msg ); } - // TODO: put into the deployer - if ( deploymentRepository.getAuthenticationInfo() == null ) - { - getLog().warn( "Deployment repository {id: \'" + deploymentRepository.getId() + - "\'} has no associated authentication info!" ); - } - // Deploy the POM Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), project.getPackaging() ); @@ -102,7 +95,8 @@ public class DeployMojo { if ( !isPomArtifact ) { - deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository ); + deployer.deploy( project.getBuild().getDirectory(), project.getBuild().getFinalName(), artifact, + deploymentRepository, localRepository ); } else { diff --git a/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java b/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java index 1f3639a178..4073018e30 100644 --- a/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java +++ b/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java @@ -80,7 +80,9 @@ public class InstallMojo { if ( !isPomArtifact ) { - installer.install( project.getBuild().getDirectory(), artifact, localRepository ); + // TODO: would be something nice to get back from the project to get the full filename (the OGNL feedback thing) + installer.install( project.getBuild().getDirectory(), project.getBuild().getFinalName(), artifact, + localRepository ); } else {