Author: jdcasey Date: Fri Jun 26 17:48:27 2009 New Revision: 788788 URL: http://svn.apache.org/viewvc?rev=788788&view=rev Log: reverting mistaken commit.
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=788788&r1=788787&r2=788788&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:48:27 2009 @@ -40,7 +40,6 @@ 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; @@ -57,7 +56,6 @@ 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; @@ -87,11 +85,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; @@ -124,7 +122,7 @@ private ArtifactRepository snapshotArtifactRepository; - private List<Profile> activeProfiles = new ArrayList<Profile>(); + private List activeProfiles = new ArrayList(); private Set dependencyArtifacts; @@ -145,28 +143,28 @@ private Map extensionArtifactMap; - private Map<String, Artifact> managedVersionMap; + private Map managedVersionMap; private Map projectReferences = new HashMap(); private boolean executionRoot; - - private Map<String, String> moduleAdjustments; + + private Map 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 ); } @@ -284,12 +282,12 @@ { setManagedVersionMap( new ManagedVersionMap( project.getManagedVersionMap() ) ); } - + if ( project.getReleaseArtifactRepository() != null ) { setReleaseArtifactRepository( project.getReleaseArtifactRepository() ); } - + if ( project.getSnapshotArtifactRepository() != null ) { setSnapshotArtifactRepository( project.getSnapshotArtifactRepository() ); @@ -326,53 +324,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<String, String>(); - - List<String> modules = getModules(); + moduleAdjustments = new HashMap(); + + List 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 ); @@ -383,7 +381,7 @@ } } } - + return (String) moduleAdjustments.get( module ); } @@ -443,15 +441,15 @@ { return; } - + if ( basedir == null ) { basedir = file.getParentFile(); } - + this.file = file; } - + public void setBasedir( File basedir ) { this.basedir = basedir; @@ -629,7 +627,8 @@ list.add( getBuild().getTestOutputDirectory() ); list.add( getBuild().getOutputDirectory() ); - for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); ) + + for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); @@ -907,7 +906,7 @@ { groupId = getModel().getParent().getGroupId(); } - + return groupId; } @@ -952,7 +951,7 @@ { version = getModel().getParent().getVersion(); } - + return version; } @@ -1160,10 +1159,9 @@ } /** - * 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} < {...@link Artifact} > * @see #getDependencyArtifacts() to get only direct dependencies */ @@ -1303,7 +1301,7 @@ return pluginMgmt; } - + private Build getModelBuild() { Build build = getModel().getBuild(); @@ -1314,7 +1312,7 @@ getModel().setBuild( build ); } - + return build; } @@ -1330,7 +1328,7 @@ build.flushPluginMap(); } } - + public void injectPluginManagementInfo( Plugin plugin ) { PluginManagement pm = getModelBuild().getPluginManagement(); @@ -1385,12 +1383,12 @@ return getModel().getPluginRepositories(); } - public void setActiveProfiles( List<Profile> activeProfiles ) + public void setActiveProfiles( List activeProfiles ) { this.activeProfiles.addAll( activeProfiles ); } - public List<Profile> getActiveProfiles() + public List getActiveProfiles() { return activeProfiles; } @@ -1447,7 +1445,7 @@ } } } - + // PluginManagement pluginManagement = getBuild().getPluginManagement(); // if ( pluginManagement != null && pluginManagement.getPlugins() != null ) // { @@ -1472,7 +1470,7 @@ // } // } // } - // +// // dom = Xpp3Dom.mergeXpp3Dom( dom, managedDom ); // break; // } @@ -1596,12 +1594,12 @@ return originalModel; } - public void setManagedVersionMap( Map<String, Artifact> map ) + public void setManagedVersionMap( Map map ) { this.managedVersionMap = map; } - public Map<String, Artifact> getManagedVersionMap() + public Map getManagedVersionMap() { return this.managedVersionMap; } @@ -1736,7 +1734,7 @@ { return snapshotArtifactRepository; } - + public void resolveActiveArtifacts() { Set depArtifacts = getDependencyArtifacts(); @@ -1744,23 +1742,23 @@ { return; } - - Set<Artifact> updated = new LinkedHashSet<Artifact>( depArtifacts.size() ); + + Set updated = new LinkedHashSet( depArtifacts.size() ); int updatedCount = 0; - - for ( Iterator<Artifact> it = depArtifacts.iterator(); it.hasNext(); ) + + for ( Iterator 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 ); @@ -1881,7 +1879,7 @@ { return; } - + if ( logger.isDebugEnabled() ) { StringBuffer message = new StringBuffer(); @@ -1891,7 +1889,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 @@ -1909,7 +1907,7 @@ } list.add( file.getPath() ); } - + /** * Default toString */ @@ -1923,8 +1921,8 @@ sb.append( ":" ); sb.append( this.getVersion() ); sb.append( " @ " ); - - try + + try { sb.append( this.getFile().getPath() ); } @@ -1932,10 +1930,10 @@ { //don't log it. } - - return sb.toString(); + + return sb.toString(); } - + /** * @throws CloneNotSupportedException * @since 2.0.9 @@ -1951,7 +1949,7 @@ // ---------------------------------------------------------------------------- // CODE BELOW IS USED TO PRESERVE DYNAMISM IN THE BUILD SECTION OF THE POM. // ---------------------------------------------------------------------------- - + private Build dynamicBuild; private Build originalInterpolatedBuild; @@ -2102,9 +2100,9 @@ { this.originalInterpolatedScriptSourceRoots = originalInterpolatedScriptSourceRoots; } - + private Properties preservedProperties; - + public Properties getPreservedProperties() { return preservedProperties; @@ -2123,9 +2121,9 @@ } } } - + private File preservedBasedir; - + public File getPreservedBasedir() { return preservedBasedir;