Removing attached-Artifact creation code, replacing with MavenProjectHelper.attachArtifact(..).

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@233049 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-08-16 20:19:38 +00:00
parent e21120a0a4
commit 345798c7ab
2 changed files with 8 additions and 30 deletions

View File

@ -17,7 +17,6 @@ package org.apache.maven.plugin.assembly;
*/ */
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
@ -29,6 +28,7 @@ import org.apache.maven.plugins.assembly.model.DependencySet;
import org.apache.maven.plugins.assembly.model.FileSet; import org.apache.maven.plugins.assembly.model.FileSet;
import org.apache.maven.plugins.assembly.model.io.xpp3.AssemblyXpp3Reader; import org.apache.maven.plugins.assembly.model.io.xpp3.AssemblyXpp3Reader;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.jar.JarArchiver; import org.codehaus.plexus.archiver.jar.JarArchiver;
@ -87,11 +87,11 @@ public class AssemblyMojo
private MavenProject project; private MavenProject project;
/** /**
* @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}" * @parameter expression="${component.org.apache.maven.project.MavenProjectHelper}"
* @required * @required
* @readonly * @readonly
*/ */
private ArtifactFactory artifactFactory; private MavenProjectHelper projectHelper;
@ -156,7 +156,7 @@ public class AssemblyMojo
archiver.setDestFile( destFile ); archiver.setDestFile( destFile );
archiver.createArchive(); archiver.createArchive();
addAttachedArtifact( destFile , format); projectHelper.attachArtifact(project, format, format + "-assembly", destFile );
} }
} }
finally finally
@ -165,21 +165,6 @@ public class AssemblyMojo
} }
} }
private void addAttachedArtifact(File destFile, String format) {
Artifact artifact = artifactFactory.createArtifactWithClassifier(
project.getGroupId(),
project.getArtifactId(),
project.getVersion(),
format,
null );
artifact.setFile( destFile );
project.addAttachedArtifact( artifact );
}
private void processDependencySets(Archiver archiver, List dependencySets, boolean includeBaseDirectory) throws ArchiverException, IOException, Exception { private void processDependencySets(Archiver archiver, List dependencySets, boolean includeBaseDirectory) throws ArchiverException, IOException, Exception {
for ( Iterator i = dependencySets.iterator(); i.hasNext(); ) for ( Iterator i = dependencySets.iterator(); i.hasNext(); )
{ {

View File

@ -18,11 +18,10 @@ package org.apache.maven.plugin.ejb;
import org.apache.maven.archiver.MavenArchiveConfiguration; import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.archiver.MavenArchiver; import org.apache.maven.archiver.MavenArchiver;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import java.io.File; import java.io.File;
@ -75,11 +74,11 @@ public class EjbMojo
private MavenProject project; private MavenProject project;
/** /**
* @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}" * @parameter expression="${component.org.apache.maven.project.MavenProjectHelper}"
* @required * @required
* @readonly * @readonly
*/ */
private ArtifactFactory artifactFactory; private MavenProjectHelper projectHelper;
/** /**
* @parameter * @parameter
@ -131,13 +130,7 @@ public class EjbMojo
clientArchiver.createArchive( project, archive ); clientArchiver.createArchive( project, archive );
// TODO: shouldn't need classifer // TODO: shouldn't need classifer
Artifact artifact = artifactFactory.createArtifactWithClassifier( project.getGroupId(), projectHelper.attachArtifact( project, "ejb-client", "client", clientJarFile );
project.getArtifactId(),
project.getVersion(), null,
"ejb-client", "client" );
artifact.setFile( clientJarFile );
project.addAttachedArtifact( artifact );
} }
} }
catch ( Exception e ) catch ( Exception e )