correct problem where anything with a modified finalName was not installed/deployed

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163980 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-20 16:44:36 +00:00
parent a75e7d2577
commit d23c299e0f
15 changed files with 29 additions and 53 deletions

View File

@ -68,7 +68,7 @@ public class DeployTask
{
if ( !isPomArtifact )
{
deployer.deploy( pom.getBuild().getDirectory(), artifact, deploymentRepository, localRepo );
deployer.deploy( file, artifact, deploymentRepository, localRepo );
}
else
{

View File

@ -64,7 +64,7 @@ public class InstallTask
{
if ( !isPomArtifact )
{
installer.install( pom.getBuild().getDirectory(), artifact, localRepo );
installer.install( file, artifact, localRepo );
}
else
{

View File

@ -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;

View File

@ -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?

View File

@ -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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
@ -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";

View File

@ -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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @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();

View File

@ -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 <a href="mailto:carlos@apache.org">Carlos Sanchez </a>
* @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()
{

View File

@ -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 <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @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()
{

View File

@ -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;

View File

@ -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 )
{

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -19,18 +19,18 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-alpha-1</version>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>1.0-alpha-2</version>
<version>1.0-alpha-3-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-alpha-2</version>
<version>1.0-alpha-3-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
</dependencies>

View File

@ -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
{

View File

@ -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
{