Hi,
i'm currently trying to solve a problem, which i don't understand:
I have the following code:
/**
* The project currently being build.
*/
@Component
private MavenProject mavenProject;
/**
* The current Maven session.
*/
@Component
private MavenSession mavenSession;
@Component
private ArtifactResolver artifactResolver;
@Component
protected ArtifactRepositoryFactory artifactRepositoryFactory;
@Component( role = ArtifactRepositoryLayout.class )
private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
@Component
private ArtifactInstaller artifactInstaller;
@Parameter( property = "localRepository", required = true, readonly
= true )
protected ArtifactRepository localRepository;
public void execute()
throws MojoExecutionException
{
ArtifactRepository targetRepository =
artifactRepositoryFactory.createDeploymentArtifactRepository( "local",
getFolder().toURI().toString(),
repositoryLayouts.get( "flat" ), false /* uniqueVersion */);
ProjectDependencyGraph projectDependencyGraph =
mavenSession.getProjectDependencyGraph();
List<MavenProject> sortedProjects =
projectDependencyGraph.getSortedProjects();
for ( MavenProject sortedMavenProject : sortedProjects )
{
getLog().info( "---> " + sortedMavenProject.getId() );
Artifact artifact = sortedMavenProject.getArtifact();
try
{
artifactInstaller.install( artifact.getFile(),
artifact, targetRepository );
}
catch ( ArtifactInstallationException e )
{
getLog().error( "Error during installation of
artifacts", e );
}
}
}
The problem i have is during the following code:
artifactInstaller.install( artifact.getFile(), artifact, targetRepository );
artifact.getFile() is null, cause the artifact is comming from the
reactor. In this case i need to access the artifacts based on the
sortedProjects list.
So the question is: How can i use an artifact which is within the
reactor and how can i install (copy) this artifact to a particular
location without the aboved described problem?
Apart from that is it possible to control if maven-metadata-local.xml is
installed into that repository or not?
Thanks in advance.
Kind regards
Karl-Heinz Marbaise
--
SoftwareEntwicklung Beratung Schulung Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl-Heinz Marbaise ICQ#: 135949029
Hauptstrasse 177 USt.IdNr: DE191347579
52146 Würselen http://www.soebes.de
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email