You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2011/12/09 19:30:27 UTC

svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

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



Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Benson Margulies <bi...@gmail.com>.
On Fri, Dec 9, 2011 at 2:19 PM, Stephen Connolly
<st...@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, <bi...@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-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Benson Margulies <bi...@gmail.com>.
On Fri, Dec 9, 2011 at 6:12 PM, Stephen Connolly
<st...@gmail.com> wrote:
> My point is that if returning classes is correct for a "jar" with no
> classifier, then the correct thing to do for a "test-jar" is return
> test-classes

Right. I didn't break that code which was already there.
>

> On 9 December 2011 22:29, Benson Margulies <bi...@gmail.com> wrote:
>> On Fri, Dec 9, 2011 at 2:22 PM, Stephen Connolly
>> <st...@gmail.com> wrote:
>>> it is left as an exercise to the reader to navigate the full fun of test
>>> jars (classifier test type jar or no classifier and type test-jar or some
>>> other wantonness (phone for once suggested suitable autocorrect fir
>>> randomness))
>>>
>>> source jars could also be resolved too... but i would suggest not.
>>
>> Some more explication:
>>
>> Step 1: org.apache.maven.ReactorReader.findMatchingArtifact(MavenProject,
>> Artifact) is trying to find a matching artifact, but did not take type
>> or classifier into account at all. There is no reason for special
>> handling of test-jar/tests here.
>>
>> Step 2: org.apache.maven.ReactorReader.find(MavenProject, Artifact) is
>> implementing the fallback to 'classes' directories. For tests, it
>> already checks both type and classifier to tell what's a test jar.
>> However, when the artifact is not a test jar, the code went ahead and
>> returned 'classes' for *anything*, regardless of type or classifier,
>> if 'compile' was in the lifecycle.
>>
>>
>>
>>
>>>
>>> - 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 19:19, "Stephen Connolly" <st...@gmail.com>
>>> wrote:
>>>
>>>> refinement: test-jar should resolve to test-classes as a fallback
>>>>
>>>> - 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, <bi...@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-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

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


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Stephen Connolly <st...@gmail.com>.
To further clarify, the correct thing to do for a "test-jar" when
there is no test-jar, is to fall back to test-classes

On 9 December 2011 23:12, Stephen Connolly
<st...@gmail.com> wrote:
> My point is that if returning classes is correct for a "jar" with no
> classifier, then the correct thing to do for a "test-jar" is return
> test-classes
>
> On 9 December 2011 22:29, Benson Margulies <bi...@gmail.com> wrote:
>> On Fri, Dec 9, 2011 at 2:22 PM, Stephen Connolly
>> <st...@gmail.com> wrote:
>>> it is left as an exercise to the reader to navigate the full fun of test
>>> jars (classifier test type jar or no classifier and type test-jar or some
>>> other wantonness (phone for once suggested suitable autocorrect fir
>>> randomness))
>>>
>>> source jars could also be resolved too... but i would suggest not.
>>
>> Some more explication:
>>
>> Step 1: org.apache.maven.ReactorReader.findMatchingArtifact(MavenProject,
>> Artifact) is trying to find a matching artifact, but did not take type
>> or classifier into account at all. There is no reason for special
>> handling of test-jar/tests here.
>>
>> Step 2: org.apache.maven.ReactorReader.find(MavenProject, Artifact) is
>> implementing the fallback to 'classes' directories. For tests, it
>> already checks both type and classifier to tell what's a test jar.
>> However, when the artifact is not a test jar, the code went ahead and
>> returned 'classes' for *anything*, regardless of type or classifier,
>> if 'compile' was in the lifecycle.
>>
>>
>>
>>
>>>
>>> - 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 19:19, "Stephen Connolly" <st...@gmail.com>
>>> wrote:
>>>
>>>> refinement: test-jar should resolve to test-classes as a fallback
>>>>
>>>> - 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, <bi...@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-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>

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


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Stephen Connolly <st...@gmail.com>.
My point is that if returning classes is correct for a "jar" with no
classifier, then the correct thing to do for a "test-jar" is return
test-classes

On 9 December 2011 22:29, Benson Margulies <bi...@gmail.com> wrote:
> On Fri, Dec 9, 2011 at 2:22 PM, Stephen Connolly
> <st...@gmail.com> wrote:
>> it is left as an exercise to the reader to navigate the full fun of test
>> jars (classifier test type jar or no classifier and type test-jar or some
>> other wantonness (phone for once suggested suitable autocorrect fir
>> randomness))
>>
>> source jars could also be resolved too... but i would suggest not.
>
> Some more explication:
>
> Step 1: org.apache.maven.ReactorReader.findMatchingArtifact(MavenProject,
> Artifact) is trying to find a matching artifact, but did not take type
> or classifier into account at all. There is no reason for special
> handling of test-jar/tests here.
>
> Step 2: org.apache.maven.ReactorReader.find(MavenProject, Artifact) is
> implementing the fallback to 'classes' directories. For tests, it
> already checks both type and classifier to tell what's a test jar.
> However, when the artifact is not a test jar, the code went ahead and
> returned 'classes' for *anything*, regardless of type or classifier,
> if 'compile' was in the lifecycle.
>
>
>
>
>>
>> - 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 19:19, "Stephen Connolly" <st...@gmail.com>
>> wrote:
>>
>>> refinement: test-jar should resolve to test-classes as a fallback
>>>
>>> - 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, <bi...@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

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


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Benson Margulies <bi...@gmail.com>.
On Fri, Dec 9, 2011 at 2:22 PM, Stephen Connolly
<st...@gmail.com> wrote:
> it is left as an exercise to the reader to navigate the full fun of test
> jars (classifier test type jar or no classifier and type test-jar or some
> other wantonness (phone for once suggested suitable autocorrect fir
> randomness))
>
> source jars could also be resolved too... but i would suggest not.

Some more explication:

Step 1: org.apache.maven.ReactorReader.findMatchingArtifact(MavenProject,
Artifact) is trying to find a matching artifact, but did not take type
or classifier into account at all. There is no reason for special
handling of test-jar/tests here.

Step 2: org.apache.maven.ReactorReader.find(MavenProject, Artifact) is
implementing the fallback to 'classes' directories. For tests, it
already checks both type and classifier to tell what's a test jar.
However, when the artifact is not a test jar, the code went ahead and
returned 'classes' for *anything*, regardless of type or classifier,
if 'compile' was in the lifecycle.




>
> - 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 19:19, "Stephen Connolly" <st...@gmail.com>
> wrote:
>
>> refinement: test-jar should resolve to test-classes as a fallback
>>
>> - 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, <bi...@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-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Stephen Connolly <st...@gmail.com>.
it is left as an exercise to the reader to navigate the full fun of test
jars (classifier test type jar or no classifier and type test-jar or some
other wantonness (phone for once suggested suitable autocorrect fir
randomness))

source jars could also be resolved too... but i would suggest not.

- 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 19:19, "Stephen Connolly" <st...@gmail.com>
wrote:

> refinement: test-jar should resolve to test-classes as a fallback
>
> - 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, <bi...@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
>>
>>
>>

Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Stephen Connolly <st...@gmail.com>.
refinement: test-jar should resolve to test-classes as a fallback

- 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, <bi...@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
>
>
>

Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Benson Margulies <bi...@gmail.com>.
On Fri, Dec 9, 2011 at 5:27 PM, Olivier Lamy <ol...@apache.org> wrote:
> Did you try to use the ant bootstrap build ? (which will be faster IMHO )

No, I did not.

>
> 2011/12/9 Benson Margulies <bi...@gmail.com>:
>> As for the format; I explained in the svn comment. I found it
>> convenient to be able to just run the newly-built package without
>> unpacking it. If it really bugs anyone I can undo it.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

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


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Olivier Lamy <ol...@apache.org>.
Did you try to use the ant bootstrap build ? (which will be faster IMHO )

2011/12/9 Benson Margulies <bi...@gmail.com>:
> As for the format; I explained in the svn comment. I found it
> convenient to be able to just run the newly-built package without
> unpacking it. If it really bugs anyone I can undo it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Benson Margulies <bi...@gmail.com>.
As for the format; I explained in the svn comment. I found it
convenient to be able to just run the newly-built package without
unpacking it. If it really bugs anyone I can undo it.

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


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Benson Margulies <bi...@gmail.com>.
Yes, I can. Can you tell me where some similar tests live?

On Fri, Dec 9, 2011 at 2:43 PM, Olivier Lamy <ol...@apache.org> wrote:
> Hello,
>
> 2011/12/9  <bi...@apache.org>:
>> 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>
>
> Why ?
>
> I wonder if you could add a core it test for this use case ?
> The use case is the cxf build you pointed ?
>
>>     <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
>>
>>
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

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


Re: svn commit: r1212564 - in /maven/maven-3/trunk: apache-maven/src/main/assembly/bin.xml maven-core/src/main/java/org/apache/maven/ReactorReader.java

Posted by Olivier Lamy <ol...@apache.org>.
Hello,

2011/12/9  <bi...@apache.org>:
> 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>

Why ?

I wonder if you could add a core it test for this use case ?
The use case is the cxf build you pointed ?

>     <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
>
>



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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