You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Daniel Kulp (JIRA)" <ji...@codehaus.org> on 2013/07/08 19:31:05 UTC

[jira] (MRRESOURCES-62) test-jar classifier fails in multi-module projects

     [ https://jira.codehaus.org/browse/MRRESOURCES-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp closed MRRESOURCES-62.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5
         Assignee: Daniel Kulp
    
> test-jar classifier fails in multi-module projects
> --------------------------------------------------
>
>                 Key: MRRESOURCES-62
>                 URL: https://jira.codehaus.org/browse/MRRESOURCES-62
>             Project: Maven 2.x Remote Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Jeff Maxwell
>            Assignee: Daniel Kulp
>            Priority: Critical
>             Fix For: 1.5
>
>
> If a resourceBundle is a test-jar of a sibling project the process step will attempt to pull resources from /classes
> {code}
>     @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;
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira