maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <bimargul...@gmail.com>
Subject 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
Date Sat, 10 Dec 2011 01:40:31 GMT
On Fri, Dec 9, 2011 at 6:12 PM, Stephen Connolly
<stephen.alan.connolly@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 <bimargulies@gmail.com> wrote:
>> On Fri, Dec 9, 2011 at 2:22 PM, Stephen Connolly
>> <stephen.alan.connolly@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" <stephen.alan.connolly@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, <bimargulies@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


Mime
View raw message