You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2009/06/26 19:10:37 UTC

svn commit: r788769 - /maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java

Author: jdcasey
Date: Fri Jun 26 17:10:37 2009
New Revision: 788769

URL: http://svn.apache.org/viewvc?rev=788769&view=rev
Log:
repairing from merge

Modified:
    maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java

Modified: maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=788769&r1=788768&r2=788769&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Fri Jun 26 17:10:37 2009
@@ -40,6 +40,7 @@
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.ManagedVersionMap;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.CiManagement;
 import org.apache.maven.model.Contributor;
@@ -56,6 +57,7 @@
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.model.PluginManagement;
 import org.apache.maven.model.Prerequisites;
+import org.apache.maven.model.Profile;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.model.ReportSet;
 import org.apache.maven.model.Reporting;
@@ -85,11 +87,11 @@
     implements Cloneable
 {
     public static final String EMPTY_PROJECT_GROUP_ID = "unknown";
-    
+
     public static final String EMPTY_PROJECT_ARTIFACT_ID = "empty-project";
-    
+
     public static final String EMPTY_PROJECT_VERSION = "0";
-    
+
     private Model model;
 
     private MavenProject parent;
@@ -122,7 +124,7 @@
 
     private ArtifactRepository snapshotArtifactRepository;
 
-    private List activeProfiles = new ArrayList();
+    private List<Profile> activeProfiles = new ArrayList<Profile>();
 
     private Set dependencyArtifacts;
 
@@ -143,28 +145,28 @@
 
     private Map extensionArtifactMap;
 
-    private Map managedVersionMap;
+    private Map<String, Artifact> managedVersionMap;
 
     private Map projectReferences = new HashMap();
 
     private boolean executionRoot;
-    
-    private Map moduleAdjustments;
+
+    private Map<String, String> moduleAdjustments;
 
     private File basedir;
-    
+
     private Logger logger;
-    
+
     private ProjectBuilderConfiguration projectBuilderConfiguration;
-    
+
     public MavenProject()
     {
         Model model = new Model();
-        
+
         model.setGroupId( EMPTY_PROJECT_GROUP_ID );
         model.setArtifactId( EMPTY_PROJECT_ARTIFACT_ID );
         model.setVersion( EMPTY_PROJECT_VERSION );
-        
+
         this.setModel( model );
     }
 
@@ -282,12 +284,12 @@
         {
             setManagedVersionMap( new ManagedVersionMap( project.getManagedVersionMap() ) );
         }
-        
+
         if ( project.getReleaseArtifactRepository() != null )
         {
             setReleaseArtifactRepository( project.getReleaseArtifactRepository() );
         }
-        
+
         if ( project.getSnapshotArtifactRepository() != null )
         {
             setSnapshotArtifactRepository( project.getSnapshotArtifactRepository() );
@@ -324,53 +326,53 @@
         preservedBasedir = project.preservedBasedir;
         setConcrete( project.isConcrete() );
     }
-    
+
     public String getModulePathAdjustment( MavenProject moduleProject ) throws IOException
     {
         // FIXME: This is hacky. What if module directory doesn't match artifactid, and parent
         // is coming from the repository??
-        
-        // FIXME: If there is a hierarchy of three projects, with the url specified at the top, 
+
+        // FIXME: If there is a hierarchy of three projects, with the url specified at the top,
         // and the top two projects are referenced from copies that are in the repository, the
         // middle-level POM doesn't have a File associated with it (or the file's directory is
         // of an unexpected name), and module path adjustments fail.
         String module = moduleProject.getArtifactId();
-        
+
         File moduleFile = moduleProject.getFile();
-        
+
         if ( moduleFile != null )
         {
             File moduleDir = moduleFile.getCanonicalFile().getParentFile();
-            
+
             module = moduleDir.getName();
         }
-        
+
         if ( moduleAdjustments == null )
         {
-            moduleAdjustments = new HashMap();
-            
-            List modules = getModules();
+            moduleAdjustments = new HashMap<String, String>();
+
+            List<String> modules = getModules();
             if ( modules != null )
             {
                 for ( Iterator it = modules.iterator(); it.hasNext(); )
                 {
                     String modulePath = (String) it.next();
                     String moduleName = modulePath;
-                    
+
                     if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) )
                     {
                         moduleName = moduleName.substring( 0, moduleName.length() - 1 );
                     }
-                    
+
                     int lastSlash = moduleName.lastIndexOf( '/' );
-                    
+
                     if ( lastSlash < 0 )
                     {
                         lastSlash = moduleName.lastIndexOf( '\\' );
                     }
-                    
+
                     String adjustment = null;
-                    
+
                     if ( lastSlash > -1 )
                     {
                         moduleName = moduleName.substring( lastSlash + 1 );
@@ -381,7 +383,7 @@
                 }
             }
         }
-        
+
         return (String) moduleAdjustments.get( module );
     }
 
@@ -441,15 +443,15 @@
         {
             return;
         }
-        
+
         if ( basedir == null )
         {
             basedir = file.getParentFile();
         }
-        
+
         this.file = file;
     }
-    
+
     public void setBasedir( File basedir )
     {
         this.basedir = basedir;
@@ -627,8 +629,7 @@
         list.add( getBuild().getTestOutputDirectory() );
 
         list.add( getBuild().getOutputDirectory() );
-        
-        for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
+        for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
         {
             Artifact a = (Artifact) i.next();
 
@@ -906,7 +907,7 @@
         {
             groupId = getModel().getParent().getGroupId();
         }
-        
+
         return groupId;
     }
 
@@ -951,7 +952,7 @@
         {
             version = getModel().getParent().getVersion();
         }
-        
+
         return version;
     }
 
@@ -1159,9 +1160,10 @@
     }
 
     /**
-     * All dependencies that this project has, including transitive ones.
-     * Contents are lazily populated, so depending on what phases have run dependencies in some scopes won't be included.
-     * eg. if only compile phase has run, dependencies with scope test won't be included. 
+     * All dependencies that this project has, including transitive ones. Contents are lazily populated, so depending on
+     * what phases have run dependencies in some scopes won't be included. eg. if only compile phase has run,
+     * dependencies with scope test won't be included.
+     * 
      * @return {@link Set} &lt; {@link Artifact} >
      * @see #getDependencyArtifacts() to get only direct dependencies
      */
@@ -1301,7 +1303,7 @@
 
         return pluginMgmt;
     }
-    
+
     private Build getModelBuild()
     {
         Build build = getModel().getBuild();
@@ -1312,7 +1314,7 @@
 
             getModel().setBuild( build );
         }
-        
+
         return build;
     }
 
@@ -1328,7 +1330,7 @@
             build.flushPluginMap();
         }
     }
-    
+
     public void injectPluginManagementInfo( Plugin plugin )
     {
         PluginManagement pm = getModelBuild().getPluginManagement();
@@ -1383,12 +1385,12 @@
         return getModel().getPluginRepositories();
     }
 
-    public void setActiveProfiles( List activeProfiles )
+    public void setActiveProfiles( List<Profile> activeProfiles )
     {
         this.activeProfiles.addAll( activeProfiles );
     }
 
-    public List getActiveProfiles()
+    public List<Profile> getActiveProfiles()
     {
         return activeProfiles;
     }
@@ -1445,7 +1447,7 @@
                 }
             }
         }
-        
+
 //        PluginManagement pluginManagement = getBuild().getPluginManagement();
 //        if ( pluginManagement != null && pluginManagement.getPlugins() != null )
 //        {
@@ -1470,7 +1472,7 @@
 //                            }
 //                        }
 //                    }
-//                    
+        //
 //                    dom = Xpp3Dom.mergeXpp3Dom( dom, managedDom );
 //                    break;
 //                }
@@ -1594,12 +1596,12 @@
         return originalModel;
     }
 
-    public void setManagedVersionMap( Map map )
+    public void setManagedVersionMap( Map<String, Artifact> map )
     {
         this.managedVersionMap = map;
     }
 
-    public Map getManagedVersionMap()
+    public Map<String, Artifact> getManagedVersionMap()
     {
         return this.managedVersionMap;
     }
@@ -1734,7 +1736,7 @@
     {
         return snapshotArtifactRepository;
     }
-    
+
     public void resolveActiveArtifacts()
     {
         Set depArtifacts = getDependencyArtifacts();
@@ -1742,23 +1744,23 @@
         {
             return;
         }
-        
-        Set updated = new LinkedHashSet( depArtifacts.size() );
+
+        Set<Artifact> updated = new LinkedHashSet<Artifact>( depArtifacts.size() );
         int updatedCount = 0;
-        
-        for ( Iterator it = depArtifacts.iterator(); it.hasNext(); )
+
+        for ( Iterator<Artifact> it = depArtifacts.iterator(); it.hasNext(); )
         {
             Artifact depArtifact = (Artifact) it.next();
             Artifact replaced = replaceWithActiveArtifact( depArtifact );
-            
+
             if ( depArtifact != replaced )
             {
                 updatedCount++;
             }
-            
+
             updated.add( replaced );
         }
-        
+
         if ( updatedCount > 0 )
         {
             setDependencyArtifacts( updated );
@@ -1879,7 +1881,7 @@
         {
             return;
         }
-        
+
         if ( logger.isDebugEnabled() )
         {
             StringBuffer message = new StringBuffer();
@@ -1889,7 +1891,7 @@
             message.append( "\nRequested Dependency: " ).append( artifact.getId() );
             message.append( "\n\nNOTE: You may need to run this build to the 'compile' lifecycle phase, or farther, in order to build the dependency artifact." );
             message.append( "\n" );
-            
+
             logger.debug( message.toString() );
         }
         else
@@ -1907,7 +1909,7 @@
         }
         list.add( file.getPath() );
     }
-    
+
     /**
      * Default toString
      */
@@ -1921,8 +1923,8 @@
         sb.append( ":" );
         sb.append( this.getVersion() );
         sb.append( " @ " );
-        
-        try 
+
+        try
         {
             sb.append( this.getFile().getPath() );
         }
@@ -1930,10 +1932,10 @@
         {
             //don't log it.
         }
-        
-        return sb.toString();        
+
+        return sb.toString();
     }
-    
+
     /**
      * @throws CloneNotSupportedException
      * @since 2.0.9
@@ -1949,7 +1951,7 @@
 // ----------------------------------------------------------------------------
 // CODE BELOW IS USED TO PRESERVE DYNAMISM IN THE BUILD SECTION OF THE POM.
 // ----------------------------------------------------------------------------
-    
+
     private Build dynamicBuild;
 
     private Build originalInterpolatedBuild;
@@ -2100,9 +2102,9 @@
     {
         this.originalInterpolatedScriptSourceRoots = originalInterpolatedScriptSourceRoots;
     }
-    
+
     private Properties preservedProperties;
-    
+
     public Properties getPreservedProperties()
     {
         return preservedProperties;
@@ -2121,9 +2123,9 @@
             }
         }
     }
-    
+
     private File preservedBasedir;
-    
+
     public File getPreservedBasedir()
     {
         return preservedBasedir;