maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r732929 - in /maven/components/trunk: maven-compat/src/main/java/org/apache/maven/artifact/ maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/ maven-core/src/main/java/org/apache/maven/plugin/ maven-project/src/main/java/...
Date Fri, 09 Jan 2009 05:34:15 GMT
Author: jvanzyl
Date: Thu Jan  8 21:34:14 2009
New Revision: 732929

URL: http://svn.apache.org/viewvc?rev=732929&view=rev
Log:
MNG-3586: system scope is working again, the IT does not appear to work on OS/X. Both 2.0.9
and this snapshot fail the first test of the IT. Brian helped me verify and on Windows with
2.0.9 and this snapshot both tests pass.

Modified:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java?rev=732929&r1=732928&r2=732929&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java
(original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java
Thu Jan  8 21:34:14 2009
@@ -55,6 +55,8 @@
 
     String SCOPE_RUNTIME = ArtifactScopeEnum.runtime.toString();
 
+    String SCOPE_RUNTIME_PLUS_SYSTEM = ArtifactScopeEnum.runtime_plus_system.toString();
+
     String SCOPE_PROVIDED = ArtifactScopeEnum.provided.toString();
 
     String SCOPE_SYSTEM = ArtifactScopeEnum.system.toString();

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java?rev=732929&r1=732928&r2=732929&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java
(original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java
Thu Jan  8 21:34:14 2009
@@ -10,7 +10,7 @@
 
 public enum ArtifactScopeEnum
 {
-    compile( 1 ), test( 2 ), runtime( 3 ), provided( 4 ), system( 5 );
+    compile( 1 ), test( 2 ), runtime( 3 ), provided( 4 ), system( 5 ), runtime_plus_system(
6 );
 
     public static final ArtifactScopeEnum DEFAULT_SCOPE = compile;
 
@@ -21,7 +21,7 @@
     {
         this.id = id;
     }
-
+    
     int getId()
     {
         return id;
@@ -62,10 +62,14 @@
         {
             return Artifact.SCOPE_PROVIDED;
         }
-        else
+        else if ( id == 5 )
         {
             return Artifact.SCOPE_SYSTEM;
         }
+        else
+        {
+            return Artifact.SCOPE_RUNTIME_PLUS_SYSTEM;
+        }
     }
     
     private static final ArtifactScopeEnum [][][] _compliancySets = {

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java?rev=732929&r1=732928&r2=732929&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
(original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
Thu Jan  8 21:34:14 2009
@@ -39,7 +39,7 @@
     private final boolean providedScope;
 
     private final boolean systemScope;
-
+    
     public ScopeArtifactFilter( String scope )
     {
         if ( Artifact.SCOPE_COMPILE.equals( scope ) )
@@ -58,6 +58,14 @@
             runtimeScope = true;
             testScope = false;
         }
+        else if ( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM.equals( scope ) )
+        {
+            systemScope = true;
+            providedScope = false;
+            compileScope = true;
+            runtimeScope = true;
+            testScope = false;
+        }
         else if ( Artifact.SCOPE_TEST.equals( scope ) )
         {
             systemScope = true;

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=732929&r1=732928&r2=732929&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Thu Jan  8 21:34:14 2009
@@ -377,9 +377,15 @@
                                     ArtifactRepository localRepository )
         throws InvalidPluginException, ArtifactNotFoundException, ArtifactResolutionException
     {
+        ArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM
);
 
         Set<Artifact> projectPluginDependencies;
 
+        // The case where we have a plugin that can host multiple versions of a particular
tool. Say the 
+        // Antlr plugin which has many versions and you may want the plugin to execute with
version 2.7.1 of
+        // Antlr versus 2.7.2. In this case the project itself would specify dependencies
within the plugin
+        // element.
+        
         try
         {
             projectPluginDependencies = MavenMetadataSource.createArtifacts(
@@ -387,7 +393,7 @@
                                                                              plugin.getDependencies(),
                                                                              null,
                                                                              coreArtifactFilterManager.getCoreArtifactFilter(),
-                                                                             project );
+                                                                             project ); 
          
         }
         catch ( InvalidDependencyVersionException e )
         {
@@ -399,10 +405,7 @@
 
         try
         {
-            resolutionGroup = artifactMetadataSource.retrieve(
-                                                               pluginArtifact,
-                                                               localRepository,
-                                                               project.getRemoteArtifactRepositories()
);
+            resolutionGroup = artifactMetadataSource.retrieve( pluginArtifact, localRepository,
project.getRemoteArtifactRepositories() );
         }
         catch ( ArtifactMetadataRetrievalException e )
         {
@@ -418,8 +421,8 @@
         try
         {
             MavenProject pluginProject =
-                mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(),
-                                                         localRepository );
+                mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(),
localRepository );
+            
             if ( pluginProject != null )
             {
                 pluginManagedDependencies = pluginProject.getManagedVersionMap();
@@ -430,8 +433,6 @@
             // this can't happen, it would have blowed up at artifactMetadataSource.retrieve()
         }
 
-//        checkPlexusUtils( resolutionGroup, artifactFactory );
-
         Set<Artifact> dependencies = new LinkedHashSet<Artifact>();
 
         // resolve the plugin dependencies specified in <plugin><dependencies>
first:
@@ -446,8 +447,6 @@
 
         repositories.addAll( project.getRemoteArtifactRepositories() );
 
-        ArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
-
         ArtifactResolutionResult result = artifactResolver.resolveTransitively(
                                                                                 dependencies,
                                                                                 pluginArtifact,
@@ -455,8 +454,7 @@
                                                                                 localRepository,
                                                                                 repositories.isEmpty()
                                                                                         
       ? Collections.EMPTY_LIST
-                                                                                        
       : new ArrayList(
-                                                                                        
                        repositories ),
+                                                                                        
       : new ArrayList( repositories ),
                                                                                 artifactMetadataSource,
                                                                                 filter );
 

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=732929&r1=732928&r2=732929&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
Thu Jan  8 21:34:14 2009
@@ -457,8 +457,10 @@
      * @return {@link Set} &lt; {@link Artifact} >
      * @todo desperately needs refactoring. It's just here because it's implementation is
maven-project specific
      */
-    public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency>
dependencies,
-                                                 String inheritedScope, ArtifactFilter dependencyFilter,
+    public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, 
+                                                 List<Dependency> dependencies,
+                                                 String inheritedScope, 
+                                                 ArtifactFilter dependencyFilter,
                                                  MavenProject project )
         throws InvalidDependencyVersionException
     {



Mime
View raw message