Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: 1.3
-
Fix Version/s: None
-
Labels:None
-
Number of attachments :
Description
If a resourceBundle is a test-jar of a sibling project the process step will attempt to pull resources from /classes
@SuppressWarnings( "unchecked" )
private List<File> downloadBundles( List<String> bundles )
throws MojoExecutionException
{
List<File> bundleArtifacts = new ArrayList<File>();
try
{
for ( String artifactDescriptor : bundles )
{
// groupId:artifactId:version[:type[:classifier]]
String[] s = artifactDescriptor.split( ":" );
File artifactFile = null;
//check if the artifact is part of the reactor
if ( mavenSession != null )
{
List<MavenProject> list = mavenSession.getSortedProjects();
for ( MavenProject p : list )
{
if ( s[0].equals( p.getGroupId() ) && s[1].equals( p.getArtifactId() ) && s[2].equals(
p.getVersion() ) )
{
// FIXME Needs to depend on classifier
// Should be like:
// if("test-jar".equals(type))
//{
// artifactFile = new File( p.getBuild().testOutputDirectory());
// }
// else
// {
artifactFile = new File( p.getBuild().getOutputDirectory() );
// }
}
}
}
if ( artifactFile == null || !artifactFile.exists() )
{
String type = ( s.length >= 4 ? s[3] : "jar" );
String classifier = ( s.length == 5 ? s[4] : null );
Artifact artifact =
artifactFactory.createDependencyArtifact( s[0], s[1], VersionRange.createFromVersion( s[2] ),
type, classifier, Artifact.SCOPE_RUNTIME );
artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository );
artifactFile = artifact.getFile();
}
bundleArtifacts.add( artifactFile );
}
}
catch ( ArtifactResolutionException e )
{
throw new MojoExecutionException( "Error downloading resources archive.", e );
}
catch ( ArtifactNotFoundException e )
{
throw new MojoExecutionException( "Resources archive cannot be found.", e );
}
return bundleArtifacts;
}