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 void execute()
{ {
if ( !isPomArtifact ) if ( !isPomArtifact )
{ {
deployer.deploy( pom.getBuild().getDirectory(), artifact, deploymentRepository, localRepo ); deployer.deploy( file, artifact, deploymentRepository, localRepo );
} }
else else
{ {

View File

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

View File

@ -25,7 +25,7 @@ public interface ArtifactDeployer
{ {
String ROLE = ArtifactDeployer.class.getName(); 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 ) ArtifactRepository localRepository )
throws ArtifactDeploymentException; throws ArtifactDeploymentException;

View File

@ -26,6 +26,7 @@
import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException; import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
import org.apache.maven.artifact.transform.ArtifactTransformation; import org.apache.maven.artifact.transform.ArtifactTransformation;
import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.TransferFailedException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
import java.io.File; import java.io.File;
@ -34,6 +35,7 @@
import java.util.List; import java.util.List;
public class DefaultArtifactDeployer public class DefaultArtifactDeployer
extends AbstractLogEnabled
implements ArtifactDeployer implements ArtifactDeployer
{ {
private WagonManager wagonManager; private WagonManager wagonManager;
@ -42,7 +44,7 @@ public class DefaultArtifactDeployer
private List artifactTransformations; 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 ) ArtifactRepository localRepository )
throws ArtifactDeploymentException throws ArtifactDeploymentException
{ {
@ -50,7 +52,8 @@ public void deploy( String basedir, Artifact artifact, ArtifactRepository deploy
try 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 ) catch ( ArtifactHandlerNotFoundException e )
{ {
@ -64,6 +67,12 @@ public void deploy( File source, Artifact artifact, ArtifactRepository deploymen
ArtifactRepository localRepository ) ArtifactRepository localRepository )
throws ArtifactDeploymentException throws ArtifactDeploymentException
{ {
if ( deploymentRepository.getAuthenticationInfo() == null )
{
getLogger().warn( "Deployment repository {id: \'" + deploymentRepository.getId() +
"\'} has no associated authentication info!" );
}
try try
{ {
// TODO: better to have a transform manager, or reuse the handler manager again so we don't have these requirements duplicated all over? // 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 @@
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.artifact.Artifact;
import java.io.File;
/** /**
* @todo these should be configurable * @todo these should be configurable
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a> * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@ -33,11 +29,6 @@ public String additionalPlugin()
return null; return null;
} }
public File source( String basedir, Artifact artifact )
{
return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + extension() );
}
public String extension() public String extension()
{ {
return "jar"; return "jar";

View File

@ -16,10 +16,6 @@
* limitations under the License. * 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> * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$ * @version $Id$
@ -28,8 +24,6 @@ public interface ArtifactHandler
{ {
static String ROLE = ArtifactHandler.class.getName(); static String ROLE = ArtifactHandler.class.getName();
File source( String basedir, Artifact artifact );
String extension(); String extension();
String directory(); String directory();

View File

@ -16,10 +16,6 @@
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.artifact.Artifact;
import java.io.File;
/** /**
* @author <a href="mailto:carlos@apache.org">Carlos Sanchez </a> * @author <a href="mailto:carlos@apache.org">Carlos Sanchez </a>
* @version $Id$ * @version $Id$
@ -27,10 +23,6 @@
public class JavadocHandler public class JavadocHandler
extends AbstractArtifactHandler extends AbstractArtifactHandler
{ {
public File source( String basedir, Artifact artifact )
{
return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "-javadocs." + extension() );
}
public String extension() public String extension()
{ {

View File

@ -16,10 +16,6 @@
* limitations under the License. * 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> * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id$ * @version $Id$
@ -27,10 +23,6 @@
public class SourceHandler public class SourceHandler
extends AbstractArtifactHandler extends AbstractArtifactHandler
{ {
public File source( String basedir, Artifact artifact )
{
return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "-sources." + extension() );
}
public String extension() public String extension()
{ {

View File

@ -34,11 +34,12 @@ public interface ArtifactInstaller
* of the source file. * of the source file.
* *
* @param basedir the directory where the artifact is stored * @param basedir the directory where the artifact is stored
* @param finalName the name of the artifact sans extension
* @param artifact the artifact definition * @param artifact the artifact definition
* @param localRepository the local repository to install into * @param localRepository the local repository to install into
* @throws ArtifactInstallationException if an error occurred installing the artifact * @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; throws ArtifactInstallationException;

View File

@ -40,14 +40,15 @@ public class DefaultArtifactInstaller
private List artifactTransformations; 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 throws ArtifactInstallationException
{ {
File source = null; File source = null;
try 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 ) catch ( ArtifactHandlerNotFoundException e )
{ {

View File

@ -50,7 +50,7 @@ public void testArtifactInstallation()
Artifact artifact = createArtifact( "artifact", "1.0" ); Artifact artifact = createArtifact( "artifact", "1.0" );
artifactDeployer.deploy( artifactBasedir, artifact, remoteRepository(), localRepository() ); artifactDeployer.deploy( artifactBasedir, "artifact-1.0", artifact, remoteRepository(), localRepository() );
assertRemoteArtifactPresent( artifact ); assertRemoteArtifactPresent( artifact );
} }

View File

@ -50,7 +50,7 @@ public void testArtifactInstallation()
Artifact artifact = createArtifact( "artifact", "1.0" ); Artifact artifact = createArtifact( "artifact", "1.0" );
artifactInstaller.install( artifactBasedir, artifact, localRepository() ); artifactInstaller.install( artifactBasedir, "artifact-1.0", artifact, localRepository() );
assertLocalArtifactPresent( artifact ); assertLocalArtifactPresent( artifact );
} }

View File

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

View File

@ -80,13 +80,6 @@ public void execute()
throw new PluginExecutionException( msg ); 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 // Deploy the POM
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
project.getPackaging() ); project.getPackaging() );
@ -102,7 +95,8 @@ public void execute()
{ {
if ( !isPomArtifact ) if ( !isPomArtifact )
{ {
deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository ); deployer.deploy( project.getBuild().getDirectory(), project.getBuild().getFinalName(), artifact,
deploymentRepository, localRepository );
} }
else else
{ {

View File

@ -80,7 +80,9 @@ public void execute()
{ {
if ( !isPomArtifact ) 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 else
{ {