On Fri, Dec 9, 2011 at 2:19 PM, Stephen Connolly
<stephen.alan.conno...@gmail.com> wrote:
> refinement: test-jar should resolve to test-classes as a fallback

It does. I didn't disturb that particular fallback. I can point you at
it if you like.


>
> - Stephen
>
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on the
> screen
> On 9 Dec 2011 18:30, <bimargul...@apache.org> wrote:
>
>> Author: bimargulies
>> Date: Fri Dec  9 18:30:26 2011
>> New Revision: 1212564
>>
>> URL: http://svn.apache.org/viewvc?rev=1212564&view=rev
>> Log:
>> MNG-5214: Dependency resolution substitutes g:a:v:jar for
>> j:a:v:something-else when something-else isn't in the reacto
>>
>> o When Aether asks the ReactorReader for a file for an artifact, remember
>> to match type and classifier. And if all else
>>  fails, do not return target/classes if the desired artifact is not of
>> type 'jar'. Arguably, if type or classifier
>>  are non-default, then we should never return those default paths at all.
>> o Add 'dir' format to make it quicker to run a quick test. If everyone
>> hates this I'll revert it.
>>
>> Modified:
>>    maven/maven-3/trunk/apache-maven/src/main/assembly/bin.xml
>>
>>  maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/ReactorReader.java
>>
>> Modified: maven/maven-3/trunk/apache-maven/src/main/assembly/bin.xml
>> URL:
>> http://svn.apache.org/viewvc/maven/maven-3/trunk/apache-maven/src/main/assembly/bin.xml?rev=1212564&r1=1212563&r2=1212564&view=diff
>>
>> ==============================================================================
>> --- maven/maven-3/trunk/apache-maven/src/main/assembly/bin.xml (original)
>> +++ maven/maven-3/trunk/apache-maven/src/main/assembly/bin.xml Fri Dec  9
>> 18:30:26 2011
>> @@ -20,6 +20,7 @@ under the License.
>>  <assembly>
>>   <id>bin</id>
>>   <formats>
>> +    <format>dir</format>
>>     <format>zip</format>
>>     <format>tar.gz</format>
>>   </formats>
>>
>> Modified:
>> maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/ReactorReader.java
>> URL:
>> http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/ReactorReader.java?rev=1212564&r1=1212563&r2=1212564&view=diff
>>
>> ==============================================================================
>> ---
>> maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/ReactorReader.java
>> (original)
>> +++
>> maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/ReactorReader.java
>> Fri Dec  9 18:30:26 2011
>> @@ -85,9 +85,10 @@ class ReactorReader
>>         {
>>             return projectArtifact.getFile();
>>         }
>> -        else if ( !hasBeenPackaged( project ) )
>> +        else if ( !hasBeenPackaged( project ) )
>>         {
>>             // fallback to loose class files only if artifacts haven't
>> been packaged yet
>> +            // and only for plain old jars. Not war files, not ear files,
>> not anything else.
>>
>>             if ( isTestArtifact( artifact ) )
>>             {
>> @@ -98,7 +99,7 @@ class ReactorReader
>>             }
>>             else
>>             {
>> -                if ( project.hasLifecyclePhase( "compile" ) )
>> +                if ( project.hasLifecyclePhase( "compile" ) &&
>> artifact.getProperty( "type", "").equals( "jar" ) ) /* also reject non-""
>> classifier? */
>>                 {
>>                     return new File(
>> project.getBuild().getOutputDirectory() );
>>                 }
>> @@ -143,7 +144,9 @@ class ReactorReader
>>         {
>>             for ( org.apache.maven.artifact.Artifact attachedArtifact :
>> attachedArtifacts )
>>             {
>> -                if ( requestedRepositoryConflictId.equals( getConflictId(
>> attachedArtifact ) ) )
>> +                if ( requestedArtifact.getProperty ( "type", "" ).equals(
>> attachedArtifact.getType() )
>> +                     && classifierComparison (
>> requestedArtifact.getClassifier(), attachedArtifact.getClassifier() )
>> +                     && requestedRepositoryConflictId.equals(
>> getConflictId( attachedArtifact ) ) )
>>                 {
>>                     return attachedArtifact;
>>                 }
>> @@ -152,6 +155,12 @@ class ReactorReader
>>
>>         return null;
>>     }
>> +
>> +    private boolean classifierComparison ( String c1, String c2 )
>> +    {
>> +        return c1 == null && c2 == null
>> +                        || ((c1 != null) && c1.equals(c2));
>> +    }
>>
>>     /**
>>      * Gets the repository conflict id of the specified artifact. Unlike
>> the dependency conflict id, the repository
>>
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to