maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r307047 - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/plugin/ maven-core/src/main/java/org/apache/maven/plugin/version/ maven-plugins/maven-project-info-reports-plugin/ maven-plugins/maven-project-info-reports-plug...
Date Fri, 07 Oct 2005 08:03:44 GMT
Author: brett
Date: Fri Oct  7 01:03:25 2005
New Revision: 307047

URL: http://svn.apache.org/viewcvs?rev=307047&view=rev
Log:
PR: MNG-1108
don't resolve a default POM for a parent or dependency of type POM

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
    maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/pom.xml
    maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=307047&r1=307046&r2=307047&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
Fri Oct  7 01:03:25 2005
@@ -231,7 +231,7 @@
             Artifact artifact = artifactFactory.createProjectArtifact( plugin.getGroupId(),
plugin.getArtifactId(),
                                                                        plugin.getVersion()
);
             MavenProject project = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
-                                                                            localRepository
);
+                                                                            localRepository,
false );
             // if we don't have the required Maven version, then ignore an update
             if ( project.getPrerequisites() != null && project.getPrerequisites().getMaven()
!= null )
             {

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java?rev=307047&r1=307046&r2=307047&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
Fri Oct  7 01:03:25 2005
@@ -92,12 +92,12 @@
     {
         // before we do anything else, if this is a self-reference we need to short-circuit
the resolution process.
         String projectKey = constructPluginKey( project.getGroupId(), project.getArtifactId()
);
-        
+
         if ( projectKey.equals( constructPluginKey( groupId, artifactId ) ) )
         {
             return project.getVersion();
         }
-        
+
         // first pass...if the plugin is specified in the pom, try to retrieve the version
from there.
         String version = getVersionFromPluginConfig( groupId, artifactId, project, resolveAsReportPlugin
);
 
@@ -595,8 +595,9 @@
             }
             catch ( IOException e )
             {
-                getLogger().warn( "Cannot rewrite user-level plugin-registry.xml with new
plugin version of plugin: \'"
-                                      + groupId + ":" + artifactId + "\'.", e );
+                getLogger().warn(
+                    "Cannot rewrite user-level plugin-registry.xml with new plugin version
of plugin: \'" + groupId +
+                        ":" + artifactId + "\'.", e );
             }
             finally
             {
@@ -653,7 +654,7 @@
             if ( artifact.getFile() != null )
             {
                 MavenProject project = mavenProjectBuilder.buildFromRepository( artifact,
remoteRepositories,
-                                                                                localRepository
);
+                                                                                localRepository,
false );
 
                 boolean pluginValid = true;
 
@@ -672,7 +673,7 @@
                 }
 
                 String artifactVersion = artifact.getVersion();
-                
+
                 if ( pluginValid && !metaVersionId.equals( artifactVersion ) )
                 {
                     version = artifactVersion;

Modified: maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/pom.xml?rev=307047&r1=307046&r2=307047&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/pom.xml (original)
+++ maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/pom.xml Fri Oct
 7 01:03:25 2005
@@ -2,7 +2,7 @@
   <parent>
     <artifactId>maven-plugin-parent</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
-    <version>2.0-beta-1</version>
+    <version>2.0-beta-4-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>maven-project-info-reports-plugin</artifactId>
@@ -10,6 +10,9 @@
   <name>Maven Project Info Reports Plugin</name>
   <version>2.0-beta-2-SNAPSHOT</version>
   <inceptionYear>2005</inceptionYear>
+  <prerequisites>
+    <maven>2.0-beta-4-SNAPSHOT</maven>
+  </prerequisites>
   <developers>
     <developer>
       <id>vsiveton</id>

Modified: maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java?rev=307047&r1=307046&r2=307047&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
(original)
+++ maven/components/trunk/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
Fri Oct  7 01:03:25 2005
@@ -351,16 +351,18 @@
         {
             Artifact projectArtifact = artifact;
 
+            boolean allowStubModel = false;
             if ( !"pom".equals( artifact.getType() ) )
             {
                 projectArtifact = artifactFactory.createProjectArtifact( artifact.getGroupId(),
                                                                          artifact.getArtifactId(),
                                                                          artifact.getVersion(),
artifact.getScope() );
+                allowStubModel = true;
             }
 
             // TODO: we should use the MavenMetadataSource instead
-            return mavenProjectBuilder.buildFromRepository( projectArtifact, project.getRepositories(),
-                                                            localRepository );
+            return mavenProjectBuilder.buildFromRepository( projectArtifact, project.getRepositories(),
localRepository,
+                                                            allowStubModel );
         }
     }
 

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=307047&r1=307046&r2=307047&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Fri Oct  7 01:03:25 2005
@@ -306,6 +306,13 @@
                                              ArtifactRepository localRepository )
         throws ProjectBuildingException
     {
+        return buildFromRepository( artifact, remoteArtifactRepositories, localRepository,
true );
+    }
+
+    public MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories,
+                                             ArtifactRepository localRepository, boolean
allowStubModel )
+        throws ProjectBuildingException
+    {
         String cacheKey = createCacheKey( artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion() );
         MavenProject project = (MavenProject) projectCache.get( cacheKey );
         if ( project != null )
@@ -313,14 +320,14 @@
             return project;
         }
 
-        Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository
);
+        Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository,
allowStubModel );
 
         return build( "Artifact [" + artifact.getId() + "]", model, localRepository, remoteArtifactRepositories,
null,
                       null );
     }
 
     private Model findModelFromRepository( Artifact artifact, List remoteArtifactRepositories,
-                                           ArtifactRepository localRepository )
+                                           ArtifactRepository localRepository, boolean allowStubModel
)
         throws ProjectBuildingException
     {
         Artifact projectArtifact;
@@ -349,6 +356,7 @@
                 artifactResolver.resolve( projectArtifact, remoteArtifactRepositories, localRepository
);
 
                 File file = projectArtifact.getFile();
+                // TODO: how can this not be true?
                 if ( projectArtifact.isResolved() )
                 {
                     model = readModel( file );
@@ -408,10 +416,14 @@
                         projectArtifact.setDownloadUrl( model.getUrl() );
                     }
                 }
-                else
+                else if ( allowStubModel )
                 {
                     model = createStubModel( projectArtifact );
                 }
+                else
+                {
+                    throw new ProjectBuildingException( "POM could not be resolved from the
repository" );
+                }
             }
             catch ( ArtifactResolutionException e )
             {
@@ -419,7 +431,14 @@
             }
             catch ( ArtifactNotFoundException e )
             {
-                model = createStubModel( projectArtifact );
+                if ( allowStubModel )
+                {
+                    model = createStubModel( projectArtifact );
+                }
+                else
+                {
+                    throw new ProjectBuildingException( "POM not found in repository", e
);
+                }
             }
         }
         else
@@ -854,7 +873,7 @@
                 // we can't query the parent to ask where it is :)
                 List remoteRepositories = new ArrayList( aggregatedRemoteWagonRepositories
);
                 remoteRepositories.addAll( parentSearchRepositories );
-                model = findModelFromRepository( parentArtifact, remoteRepositories, localRepository
);
+                model = findModelFromRepository( parentArtifact, remoteRepositories, localRepository,
false );
             }
 
             File parentProjectDir = null;

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java?rev=307047&r1=307046&r2=307047&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
Fri Oct  7 01:03:25 2005
@@ -68,6 +68,20 @@
                                       ArtifactRepository localRepository )
         throws ProjectBuildingException;
 
+    /**
+     * Build the artifact from the local repository, resolving it if necessary.
+     *
+     * @param artifact the artifact description
+     * @param localRepository the local repository
+     * @param remoteArtifactRepositories the remote repository list
+     * @param allowStubModel return a stub if the POM is not found
+     * @return the built project
+     * @throws ProjectBuildingException
+     */
+    MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories,
+                                      ArtifactRepository localRepository, boolean allowStubModel
)
+        throws ProjectBuildingException;
+
     MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository )
         throws ProjectBuildingException;
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=307047&r1=307046&r2=307047&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
Fri Oct  7 01:03:25 2005
@@ -106,8 +106,8 @@
             {
                 try
                 {
-                    project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories,
-                                                                       localRepository );
+                    project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories,
localRepository,
+                                                                       true );
                 }
                 catch ( InvalidModelException e )
                 {



Mime
View raw message