You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2008/09/08 23:43:35 UTC
svn commit: r693291 [3/4] - in
/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven:
./ profiles/ profiles/activation/ profiles/build/ profiles/injection/
project/ project/artifact/ project/builder/ project/...
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java Mon Sep 8 14:43:31 2008
@@ -19,27 +19,59 @@
* under the License.
*/
-import org.apache.maven.model.*;
+import org.apache.maven.model.Activation;
+import org.apache.maven.model.ActivationFile;
+import org.apache.maven.model.ActivationProperty;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.BuildBase;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.DeploymentRepository;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Extension;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginContainer;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.Relocation;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.RepositoryBase;
+import org.apache.maven.model.RepositoryPolicy;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.Site;
import org.apache.maven.project.inheritance.DefaultModelInheritanceAssembler;
import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
import org.codehaus.plexus.util.xml.Xpp3Dom;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
public final class ModelUtils
{
/**
* This should be the resulting ordering of plugins after merging:
- *
+ * <p/>
* Given:
- *
- * parent: X -> A -> B -> D -> E
- * child: Y -> A -> C -> D -> F
- *
+ * <p/>
+ * parent: X -> A -> B -> D -> E
+ * child: Y -> A -> C -> D -> F
+ * <p/>
* Result:
- *
- * X -> Y -> A -> B -> C -> D -> E -> F
+ * <p/>
+ * X -> Y -> A -> B -> C -> D -> E -> F
*/
public static void mergePluginLists( PluginContainer childContainer, PluginContainer parentContainer,
boolean handleAsInheritance )
@@ -114,9 +146,8 @@
// very important to use the parentPlugins List, rather than parentContainer.getPlugins()
// since this list is a local one, and may have been modified during processing.
- List results = ModelUtils.orderAfterMerge( assembledPlugins, parentPlugins,
- childContainer.getPlugins() );
-
+ List results =
+ ModelUtils.orderAfterMerge( assembledPlugins, parentPlugins, childContainer.getPlugins() );
childContainer.setPlugins( results );
@@ -231,7 +262,8 @@
String inherited = parentExecution.getInherited();
- boolean parentExecInherited = parentIsInherited && ( ( inherited == null ) || Boolean.valueOf( inherited ).booleanValue() );
+ boolean parentExecInherited =
+ parentIsInherited && ( ( inherited == null ) || Boolean.valueOf( inherited ).booleanValue() );
if ( !handleAsInheritance || parentExecInherited )
{
@@ -251,21 +283,21 @@
}
assembledExecutions.put( assembled.getId(), assembled );
- mergedExecutions.add(assembled);
+ mergedExecutions.add( assembled );
}
}
for ( Iterator it = child.getExecutions().iterator(); it.hasNext(); )
{
- PluginExecution childExecution = (PluginExecution)it.next();
+ PluginExecution childExecution = (PluginExecution) it.next();
if ( !assembledExecutions.containsKey( childExecution.getId() ) )
{
- mergedExecutions.add(childExecution);
+ mergedExecutions.add( childExecution );
}
}
- child.setExecutions(mergedExecutions);
+ child.setExecutions( mergedExecutions );
child.flushExecutionMap();
}
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java Mon Sep 8 14:43:31 2008
@@ -49,10 +49,10 @@
}
/**
- * @deprecated use {@link File} constructor for pomLocation
* @param projectId
* @param message
* @param pomLocation absolute path of the pom file
+ * @deprecated use {@link File} constructor for pomLocation
*/
protected ProjectBuildingException( String projectId, String message, String pomLocation )
{
@@ -62,10 +62,9 @@
}
/**
- *
* @param projectId
* @param message
- * @param pomFile pom file location
+ * @param pomFile pom file location
*/
public ProjectBuildingException( String projectId, String message, File pomFile )
{
@@ -77,7 +76,7 @@
/**
* @param projectId
* @param message
- * @param pomFile pom file location
+ * @param pomFile pom file location
* @param cause
*/
protected ProjectBuildingException( String projectId, String message, File pomFile, Throwable cause )
@@ -98,8 +97,7 @@
pomFile = new File( pomLocation );
}
- public ProjectBuildingException( String projectId, String message, File pomFile,
- ProfileActivationException cause )
+ public ProjectBuildingException( String projectId, String message, File pomFile, ProfileActivationException cause )
{
super( message, cause );
this.projectId = projectId;
@@ -133,7 +131,8 @@
/**
* @deprecated use {@link File} constructor for pomLocation
*/
- public ProjectBuildingException( String projectId, String message, String pomLocation, XmlPullParserException cause )
+ public ProjectBuildingException( String projectId, String message, String pomLocation,
+ XmlPullParserException cause )
{
super( message, cause );
this.projectId = projectId;
@@ -178,8 +177,7 @@
this.projectId = projectId;
}
- public ProjectBuildingException( String projectId, String message, File pomFile,
- ArtifactResolutionException cause )
+ public ProjectBuildingException( String projectId, String message, File pomFile, ArtifactResolutionException cause )
{
super( message, cause );
this.projectId = projectId;
@@ -269,12 +267,10 @@
{
super( message, cause );
this.projectId = projectId;
- pomFile = new File ( pomLocation );
+ pomFile = new File( pomLocation );
}
- public ProjectBuildingException( String projectId,
- String message,
- ModelInterpolationException cause )
+ public ProjectBuildingException( String projectId, String message, ModelInterpolationException cause )
{
super( message, cause );
this.projectId = projectId;
@@ -288,7 +284,7 @@
/**
* @deprecated use {@link #getPomFile()}
*/
- public String getPomLocation ()
+ public String getPomLocation()
{
if ( getPomFile() != null )
{
@@ -307,7 +303,7 @@
public String getMessage()
{
- return super.getMessage() + " for project " + projectId
- + ( ( getPomFile() == null ? "" : " at " + getPomFile().getAbsolutePath() ) );
+ return super.getMessage() + " for project " + projectId +
+ ( ( getPomFile() == null ? "" : " at " + getPomFile().getAbsolutePath() ) );
}
}
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java Mon Sep 8 14:43:31 2008
@@ -97,7 +97,8 @@
if ( url == null || url.trim().length() < 1 )
{
- throw new MissingRepositoryElementException( "Repository URL must not be empty (ID is: " + id + ").", id );
+ throw new MissingRepositoryElementException( "Repository URL must not be empty (ID is: " + id + ").",
+ id );
}
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/RepositoryHelper.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/RepositoryHelper.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/RepositoryHelper.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/RepositoryHelper.java Mon Sep 8 14:43:31 2008
@@ -13,23 +13,20 @@
* This is a temporary class. These methods are originally from the DefaultMavenProjectHelper. This class will be
* eliminated when Mercury is integrated.
*/
-public interface RepositoryHelper {
+public interface RepositoryHelper
+{
String ROLE = RepositoryHelper.class.getName();
- Model findModelFromRepository(Artifact artifact,
- List remoteArtifactRepositories,
- ArtifactRepository localRepository)
- throws ProjectBuildingException;
+ Model findModelFromRepository( Artifact artifact, List remoteArtifactRepositories,
+ ArtifactRepository localRepository )
+ throws ProjectBuildingException;
- List buildArtifactRepositories(Model model)
- throws ProjectBuildingException;
+ List buildArtifactRepositories( Model model )
+ throws ProjectBuildingException;
- LinkedHashSet collectInitialRepositories(Model model,
- Model superModel,
- List parentSearchRepositories,
- File pomFile,
- boolean validProfilesXmlLocation,
- ProfileActivationContext profileActivationContext)
- throws ProjectBuildingException;
+ LinkedHashSet collectInitialRepositories( Model model, Model superModel, List parentSearchRepositories,
+ File pomFile, boolean validProfilesXmlLocation,
+ ProfileActivationContext profileActivationContext )
+ throws ProjectBuildingException;
}
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java Mon Sep 8 14:43:31 2008
@@ -58,293 +58,389 @@
artifact.setResolved( true );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public File getFile()
{
// we need to get the latest file for the project, not the artifact that was created at one point in time
return project.getArtifact().getFile();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getGroupId()
{
return artifact.getGroupId();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getArtifactId()
{
return artifact.getArtifactId();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getVersion()
{
return artifact.getVersion();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setVersion( String version )
{
artifact.setVersion( version );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getScope()
{
return artifact.getScope();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getType()
{
return artifact.getType();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getClassifier()
{
return artifact.getClassifier();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public boolean hasClassifier()
{
return artifact.hasClassifier();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setFile( File destination )
{
artifact.setFile( destination );
project.getArtifact().setFile( destination );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getBaseVersion()
{
return artifact.getBaseVersion();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setBaseVersion( String baseVersion )
{
artifact.setBaseVersion( baseVersion );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getId()
{
return artifact.getId();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getDependencyConflictId()
{
return artifact.getDependencyConflictId();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void addMetadata( ArtifactMetadata metadata )
{
artifact.addMetadata( metadata );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public Collection getMetadataList()
{
return artifact.getMetadataList();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setRepository( ArtifactRepository remoteRepository )
{
artifact.setRepository( remoteRepository );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public ArtifactRepository getRepository()
{
return artifact.getRepository();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void updateVersion( String version, ArtifactRepository localRepository )
{
artifact.updateVersion( version, localRepository );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String getDownloadUrl()
{
return artifact.getDownloadUrl();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setDownloadUrl( String downloadUrl )
{
artifact.setDownloadUrl( downloadUrl );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public ArtifactFilter getDependencyFilter()
{
return artifact.getDependencyFilter();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setDependencyFilter( ArtifactFilter artifactFilter )
{
artifact.setDependencyFilter( artifactFilter );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public ArtifactHandler getArtifactHandler()
{
return artifact.getArtifactHandler();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public List getDependencyTrail()
{
return artifact.getDependencyTrail();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setDependencyTrail( List dependencyTrail )
{
artifact.setDependencyTrail( dependencyTrail );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setScope( String scope )
{
artifact.setScope( scope );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public VersionRange getVersionRange()
{
return artifact.getVersionRange();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setVersionRange( VersionRange newRange )
{
artifact.setVersionRange( newRange );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void selectVersion( String version )
{
artifact.selectVersion( version );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setGroupId( String groupId )
{
artifact.setGroupId( groupId );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setArtifactId( String artifactId )
{
artifact.setArtifactId( artifactId );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public boolean isSnapshot()
{
return artifact.isSnapshot();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public int compareTo( Object o )
{
return artifact.compareTo( o );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setResolved( boolean resolved )
{
artifact.setResolved( resolved );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public boolean isResolved()
{
return artifact.isResolved();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setResolvedVersion( String version )
{
artifact.setResolvedVersion( version );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setArtifactHandler( ArtifactHandler handler )
{
artifact.setArtifactHandler( handler );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public String toString()
{
return "active project artifact:\n\tartifact = " + artifact + ";\n\tproject: " + project;
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public boolean isRelease()
{
return artifact.isRelease();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setRelease( boolean release )
{
artifact.setRelease( release );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public List getAvailableVersions()
{
return artifact.getAvailableVersions();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setAvailableVersions( List versions )
{
artifact.setAvailableVersions( versions );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public boolean isOptional()
{
return artifact.isOptional();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public ArtifactVersion getSelectedVersion()
throws OverConstrainedVersionException
{
return artifact.getSelectedVersion();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public boolean isSelectedVersionKnown()
throws OverConstrainedVersionException
{
return artifact.isSelectedVersionKnown();
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void setOptional( boolean optional )
{
artifact.setOptional( optional );
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public int hashCode()
{
int result = 17;
@@ -361,7 +457,9 @@
return result;
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public boolean equals( Object o )
{
if ( o == this )
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java Mon Sep 8 14:43:31 2008
@@ -37,7 +37,8 @@
{
private Dependency dependency;
- public InvalidDependencyVersionException( String projectId, Dependency dependency, File pomFile, InvalidVersionSpecificationException cause )
+ public InvalidDependencyVersionException( String projectId, Dependency dependency, File pomFile,
+ InvalidVersionSpecificationException cause )
{
super( projectId, formatLocationInPom( dependency ), dependency.getVersion(), pomFile, cause );
this.dependency = dependency;
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java Mon Sep 8 14:43:31 2008
@@ -25,7 +25,11 @@
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.*;
+import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
@@ -52,7 +56,12 @@
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
/**
* @author Jason van Zyl
@@ -76,14 +85,15 @@
private PlexusContainer container;
- /** Unfortunately we have projects that are still sending us JARs without the accompanying POMs. */
+ /**
+ * Unfortunately we have projects that are still sending us JARs without the accompanying POMs.
+ */
private boolean strictlyEnforceThePresenceOfAValidMavenPOM = false;
/**
* Resolve all relocations in the POM for this artifact, and return the new artifact coordinate.
*/
- public Artifact retrieveRelocatedArtifact( Artifact artifact,
- ArtifactRepository localRepository,
+ public Artifact retrieveRelocatedArtifact( Artifact artifact, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException
{
@@ -93,20 +103,19 @@
}
ProjectRelocation rel = retrieveRelocatedProject( artifact, localRepository, remoteRepositories );
-
+
if ( rel == null )
{
return artifact;
}
-
+
MavenProject project = rel.project;
if ( project == null || getRelocationKey( artifact ).equals( getRelocationKey( project.getArtifact() ) ) )
{
return artifact;
}
-
- // NOTE: Using artifact information here, since some POMs are deployed
+ // NOTE: Using artifact information here, since some POMs are deployed
// to central with one version in the filename, but another in the <version> string!
// Case in point: org.apache.ws.commons:XmlSchema:1.1:pom.
//
@@ -115,11 +124,14 @@
Artifact result = null;
if ( artifact.getClassifier() != null )
{
- result = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier() );
+ result = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getVersion(), artifact.getType(),
+ artifact.getClassifier() );
}
else
{
- result = artifactFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getScope(), artifact.getType() );
+ result = artifactFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getVersion(), artifact.getScope(), artifact.getType() );
}
result.setScope( artifact.getScope() );
@@ -137,9 +149,8 @@
return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
}
- private ProjectRelocation retrieveRelocatedProject( Artifact artifact,
- ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories )
+ private ProjectRelocation retrieveRelocatedProject( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException
{
if ( remoteRepositories == null )
@@ -153,7 +164,8 @@
}
catch ( ComponentLookupException e )
{
- throw new ArtifactMetadataRetrievalException( "Cannot lookup MavenProjectBuilder component instance: " + e.getMessage(), e );
+ throw new ArtifactMetadataRetrievalException(
+ "Cannot lookup MavenProjectBuilder component instance: " + e.getMessage(), e );
}
MavenProject project = null;
@@ -174,7 +186,8 @@
{
try
{
- project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories, localRepository );
+ project =
+ mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories, localRepository );
}
catch ( InvalidProjectModelException e )
{
@@ -206,7 +219,7 @@
catch ( ProjectBuildingException e )
{
handleInvalidOrMissingMavenPOM( artifact, e );
-
+
project = null;
}
@@ -252,8 +265,8 @@
List available = artifact.getAvailableVersions();
if ( available != null && !available.isEmpty() )
{
- artifact.setAvailableVersions( retrieveAvailableVersions( artifact, localRepository,
- remoteRepositories ) );
+ artifact.setAvailableVersions(
+ retrieveAvailableVersions( artifact, localRepository, remoteRepositories ) );
}
@@ -265,7 +278,8 @@
message += " " + relocation.getMessage() + "\n";
}
- if ( ( artifact.getDependencyTrail() != null ) && ( artifact.getDependencyTrail().size() == 1 ) )
+ if ( ( artifact.getDependencyTrail() != null ) &&
+ ( artifact.getDependencyTrail().size() == 1 ) )
{
getLogger().warn( "While downloading " + artifact.getGroupId() + ":" +
artifact.getArtifactId() + ":" + artifact.getVersion() + message + "\n" );
@@ -333,8 +347,8 @@
// or used the inherited scope (should that be passed to the buildFromRepository method above?)
try
{
- artifacts = project.createArtifacts( artifactFactory, artifact.getScope(),
- artifact.getDependencyFilter() );
+ artifacts =
+ project.createArtifacts( artifactFactory, artifact.getScope(), artifact.getDependencyFilter() );
}
catch ( InvalidDependencyVersionException e )
{
@@ -356,17 +370,16 @@
{
if ( strictlyEnforceThePresenceOfAValidMavenPOM )
{
- throw new ArtifactMetadataRetrievalException( "Invalid POM file for artifact: '" +
- artifact.getDependencyConflictId() + "': " + e.getMessage(), e, artifact );
+ throw new ArtifactMetadataRetrievalException(
+ "Invalid POM file for artifact: '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e,
+ artifact );
}
else
{
- getLogger().warn(
- "\n\tDEPRECATION: The POM for the artifact '"
- + artifact.getDependencyConflictId()
- + "' was invalid or not found on any repositories.\n"
- + "\tThis may not be supported by future versions of Maven and should be corrected as soon as possible.\n"
- + "\tError given: " + e.getMessage() + "\n" );
+ getLogger().warn( "\n\tDEPRECATION: The POM for the artifact '" + artifact.getDependencyConflictId() +
+ "' was invalid or not found on any repositories.\n" +
+ "\tThis may not be supported by future versions of Maven and should be corrected as soon as possible.\n" +
+ "\tError given: " + e.getMessage() + "\n" );
}
}
@@ -437,11 +450,12 @@
}
/**
- * @todo desperately needs refactoring. It's just here because it's implementation is maven-project specific
* @return {@link Set} < {@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, MavenProject project )
+ public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies,
+ String inheritedScope, ArtifactFilter dependencyFilter,
+ MavenProject project )
throws InvalidDependencyVersionException
{
Set<Artifact> projectArtifacts = new LinkedHashSet<Artifact>( dependencies.size() );
@@ -536,8 +550,7 @@
return retrieveAvailableVersionsFromMetadata( metadata.getMetadata() );
}
- public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository(
- Artifact artifact,
+ public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
ArtifactRepository localRepository,
ArtifactRepository deploymentRepository )
throws ArtifactMetadataRetrievalException
@@ -569,7 +582,7 @@
}
else
{
- versions = Collections.<ArtifactVersion> emptyList();
+ versions = Collections.<ArtifactVersion>emptyList();
}
return versions;
@@ -584,6 +597,7 @@
private static final class ProjectRelocation
{
private MavenProject project;
+
private Artifact pomArtifact;
}
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java Mon Sep 8 14:43:31 2008
@@ -45,8 +45,7 @@
this( artifact, null );
}
- public ProjectArtifactMetadata( Artifact artifact,
- File file )
+ public ProjectArtifactMetadata( Artifact artifact, File file )
{
super( artifact );
this.file = file;
@@ -67,8 +66,7 @@
return getArtifactId() + "-" + artifact.getVersion() + ".pom";
}
- public void storeInLocalRepository( ArtifactRepository localRepository,
- ArtifactRepository remoteRepository )
+ public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository )
throws RepositoryMetadataStoreException
{
File destination = new File( localRepository.getBasedir(),
@@ -90,7 +88,7 @@
throw new RepositoryMetadataStoreException( "Error copying POM to the local repository.", e );
}
}
-
+
public String toString()
{
return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion();
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java Mon Sep 8 14:43:31 2008
@@ -24,7 +24,11 @@
import org.apache.maven.shared.model.ModelContainerFactory;
import org.apache.maven.shared.model.ModelProperty;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
public final class ArtifactModelContainerFactory
implements ModelContainerFactory
@@ -32,8 +36,7 @@
private static final Collection<String> uris = Collections.unmodifiableList( Arrays.asList(
- ProjectUri.DependencyManagement.Dependencies.Dependency.xUri,
- ProjectUri.Dependencies.Dependency.xUri,
+ ProjectUri.DependencyManagement.Dependencies.Dependency.xUri, ProjectUri.Dependencies.Dependency.xUri,
ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri,
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri,
@@ -69,12 +72,12 @@
private List<ModelProperty> properties;
- private static String findBaseUriFrom(List<ModelProperty> modelProperties)
+ private static String findBaseUriFrom( List<ModelProperty> modelProperties )
{
String baseUri = null;
- for(ModelProperty mp : modelProperties)
+ for ( ModelProperty mp : modelProperties )
{
- if(baseUri == null || mp.getUri().length() < baseUri.length())
+ if ( baseUri == null || mp.getUri().length() < baseUri.length() )
{
baseUri = mp.getUri();
}
@@ -86,9 +89,7 @@
{
this.properties = new ArrayList<ModelProperty>( properties );
this.properties = Collections.unmodifiableList( this.properties );
- String uri = findBaseUriFrom( this.properties );
-
-
+ String uri = findBaseUriFrom( this.properties );
for ( ModelProperty mp : this.properties )
{
@@ -104,7 +105,7 @@
{
this.groupId = mp.getValue();
}
- else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.type ) && type == null)
+ else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.type ) && type == null )
{
this.type = mp.getValue();
}
@@ -119,11 +120,12 @@
if ( artifactId == null )
{
StringBuffer sb = new StringBuffer();
- for(ModelProperty mp: properties) {
- sb.append(mp).append("\r\n");
+ for ( ModelProperty mp : properties )
+ {
+ sb.append( mp ).append( "\r\n" );
}
- throw new IllegalArgumentException(
- "Properties does not contain artifact id. Group ID = " + groupId + ", Version = " + version + ":" + sb);
+ throw new IllegalArgumentException( "Properties does not contain artifact id. Group ID = " + groupId +
+ ", Version = " + version + ":" + sb );
}
if ( type == null )
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java Mon Sep 8 14:43:31 2008
@@ -24,7 +24,11 @@
import org.apache.maven.shared.model.ModelContainerFactory;
import org.apache.maven.shared.model.ModelProperty;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
public class IdModelContainerFactory
implements ModelContainerFactory
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java Mon Sep 8 14:43:31 2008
@@ -29,7 +29,13 @@
import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
/**
* Provides a wrapper for the maven model.
@@ -75,13 +81,14 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Writer out = null;
MavenXpp3Writer writer = new MavenXpp3Writer();
- try {
+ try
+ {
out = WriterFactory.newXmlWriter( baos );
writer.write( out, model );
}
finally
{
- if(out != null)
+ if ( out != null )
{
out.close();
}
@@ -105,18 +112,20 @@
this.inputBytes = IOUtil.toByteArray( inputStream );
}
- public PomClassicDomainModel(File file)
+ public PomClassicDomainModel( File file )
throws IOException
{
- this(new FileInputStream(file));
+ this( new FileInputStream( file ) );
this.file = file;
}
- public File getParentFile() {
+ public File getParentFile()
+ {
return parentFile;
}
- public void setParentFile(File parentFile) {
+ public void setParentFile( File parentFile )
+ {
this.parentFile = parentFile;
}
@@ -163,10 +172,15 @@
return "";
}
}
- String groupId = ( model.getGroupId() == null && model.getParent() != null) ? model.getParent().getGroupId() : model.getGroupId();
- String artifactId =
- ( model.getArtifactId() == null && model.getParent() != null ) ? model.getParent().getArtifactId() : model.getArtifactId();
- String version = ( model.getVersion() == null && model.getParent() != null) ? model.getParent().getVersion() : model.getVersion();
+ String groupId = ( model.getGroupId() == null && model.getParent() != null )
+ ? model.getParent().getGroupId()
+ : model.getGroupId();
+ String artifactId = ( model.getArtifactId() == null && model.getParent() != null )
+ ? model.getParent().getArtifactId()
+ : model.getArtifactId();
+ String version = ( model.getVersion() == null && model.getParent() != null )
+ ? model.getParent().getVersion()
+ : model.getVersion();
id = groupId + ":" + artifactId + ":" + version;
}
@@ -235,8 +249,6 @@
}
/**
- *
- *
* @return file of pom. May be null.
*/
public File getFile()
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java Mon Sep 8 14:43:31 2008
@@ -20,19 +20,31 @@
*/
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.shared.model.*;
+import org.apache.maven.shared.model.DomainModel;
+import org.apache.maven.shared.model.ModelContainer;
+import org.apache.maven.shared.model.ModelContainerAction;
+import org.apache.maven.shared.model.ModelDataSource;
+import org.apache.maven.shared.model.ModelMarshaller;
+import org.apache.maven.shared.model.ModelProperty;
+import org.apache.maven.shared.model.ModelTransformer;
import org.apache.maven.shared.model.impl.DefaultModelDataSource;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.IOException;
import java.io.StringReader;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Provides methods for transforming model properties into a domain model for the pom classic format and vice versa.
*/
-public final class
- PomClassicTransformer
+public final class PomClassicTransformer
implements ModelTransformer
{
@@ -40,73 +52,74 @@
* The URIs this tranformer supports
*/
private static Set<String> uris = new HashSet<String>( Arrays.asList( ProjectUri.Build.Extensions.xUri,
- ProjectUri.Build.PluginManagement.Plugins.xUri,
- ProjectUri.Build.PluginManagement.Plugins.Plugin.configuration,
- ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
- ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
- ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.xUri,
-
- ProjectUri.Build.Plugins.xUri,
- ProjectUri.Build.Plugins.Plugin.configuration,
- ProjectUri.Build.Plugins.Plugin.Dependencies.xUri,
- ProjectUri.Build.Plugins.Plugin.Executions.xUri,
- ProjectUri.Build.Resources.xUri,
- ProjectUri.Build.Resources.Resource.includes,
- ProjectUri.Build.Resources.Resource.excludes,
- ProjectUri.Build.TestResources.xUri,
-
- ProjectUri.CiManagement.Notifiers.xUri,
-
- ProjectUri.Contributors.xUri,
-
- ProjectUri.Dependencies.xUri,
- ProjectUri.Dependencies.Dependency.Exclusions.xUri,
-
- ProjectUri.DependencyManagement.Dependencies.xUri,
- ProjectUri.DependencyManagement.Dependencies.Dependency.Exclusions.xUri,
-
- ProjectUri.Developers.xUri,
- ProjectUri.Developers.Developer.roles, ProjectUri.Licenses.xUri,
- ProjectUri.MailingLists.xUri, ProjectUri.Modules.xUri,
- ProjectUri.PluginRepositories.xUri,
-
- ProjectUri.Profiles.xUri,
- ProjectUri.Profiles.Profile.Build.Plugins.xUri,
- ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Dependencies.xUri,
- ProjectUri.Profiles.Profile.Build.Resources.xUri,
- ProjectUri.Profiles.Profile.Build.TestResources.xUri,
- ProjectUri.Profiles.Profile.Dependencies.xUri,
- ProjectUri.Profiles.Profile.Dependencies.Dependency.Exclusions.xUri,
- ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.xUri,
- ProjectUri.Profiles.Profile.PluginRepositories.xUri,
- ProjectUri.Profiles.Profile.Reporting.Plugins.xUri,
- ProjectUri.Profiles.Profile.Repositories.xUri,
-
- ProjectUri.Reporting.Plugins.xUri,
- ProjectUri.Reporting.Plugins.Plugin.ReportSets.xUri,
-
- ProjectUri.Repositories.xUri,
-
- "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies#collection",
- "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies/dependency/exclusions#collection",
- "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/executions#collection",
- "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins#collection",
- "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/dependencies/dependency/exclusions#collection",
- "http://apache.org/maven/project/profiles/profile/dependencyManagement/dependencies/dependency/exclusions#collection",
- "http://apache.org/maven/project/profiles/profile/reporting/plugins/plugin/reportSets#collection",
- "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/executions#collection" ));
+ ProjectUri.Build.PluginManagement.Plugins.xUri,
+ ProjectUri.Build.PluginManagement.Plugins.Plugin.configuration,
+ ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
+ ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
+ ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.xUri,
+
+ ProjectUri.Build.Plugins.xUri,
+ ProjectUri.Build.Plugins.Plugin.configuration,
+ ProjectUri.Build.Plugins.Plugin.Dependencies.xUri,
+ ProjectUri.Build.Plugins.Plugin.Executions.xUri,
+ ProjectUri.Build.Resources.xUri,
+ ProjectUri.Build.Resources.Resource.includes,
+ ProjectUri.Build.Resources.Resource.excludes,
+ ProjectUri.Build.TestResources.xUri,
+
+ ProjectUri.CiManagement.Notifiers.xUri,
+
+ ProjectUri.Contributors.xUri,
+
+ ProjectUri.Dependencies.xUri,
+ ProjectUri.Dependencies.Dependency.Exclusions.xUri,
+
+ ProjectUri.DependencyManagement.Dependencies.xUri,
+ ProjectUri.DependencyManagement.Dependencies.Dependency.Exclusions.xUri,
+
+ ProjectUri.Developers.xUri,
+ ProjectUri.Developers.Developer.roles,
+ ProjectUri.Licenses.xUri,
+ ProjectUri.MailingLists.xUri,
+ ProjectUri.Modules.xUri,
+ ProjectUri.PluginRepositories.xUri,
+
+ ProjectUri.Profiles.xUri,
+ ProjectUri.Profiles.Profile.Build.Plugins.xUri,
+ ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Dependencies.xUri,
+ ProjectUri.Profiles.Profile.Build.Resources.xUri,
+ ProjectUri.Profiles.Profile.Build.TestResources.xUri,
+ ProjectUri.Profiles.Profile.Dependencies.xUri,
+ ProjectUri.Profiles.Profile.Dependencies.Dependency.Exclusions.xUri,
+ ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.xUri,
+ ProjectUri.Profiles.Profile.PluginRepositories.xUri,
+ ProjectUri.Profiles.Profile.Reporting.Plugins.xUri,
+ ProjectUri.Profiles.Profile.Repositories.xUri,
+
+ ProjectUri.Reporting.Plugins.xUri,
+ ProjectUri.Reporting.Plugins.Plugin.ReportSets.xUri,
+
+ ProjectUri.Repositories.xUri,
+
+ "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies#collection",
+ "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies/dependency/exclusions#collection",
+ "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/executions#collection",
+ "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins#collection",
+ "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/dependencies/dependency/exclusions#collection",
+ "http://apache.org/maven/project/profiles/profile/dependencyManagement/dependencies/dependency/exclusions#collection",
+ "http://apache.org/maven/project/profiles/profile/reporting/plugins/plugin/reportSets#collection",
+ "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/executions#collection" ) );
private static Map<String, List<ModelProperty>> cache = new HashMap<String, List<ModelProperty>>();
private Collection<Profile> profiles;
-
//private static List<DomainModel> cache = new ArrayList<DomainModel>();
/**
* Default constructor
*/
- public PomClassicTransformer(Collection<Profile> profiles)
+ public PomClassicTransformer( Collection<Profile> profiles )
{
this.profiles = profiles;
}
@@ -139,83 +152,98 @@
ModelDataSource source = new DefaultModelDataSource();
source.init( props, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
- for(ModelContainer dependencyContainer : source.queryFor( ProjectUri.Dependencies.Dependency.xUri)) {
- for ( ModelContainer managementContainer : source.queryFor( ProjectUri.DependencyManagement.Dependencies.Dependency.xUri) )
+ for ( ModelContainer dependencyContainer : source.queryFor( ProjectUri.Dependencies.Dependency.xUri ) )
+ {
+ for ( ModelContainer managementContainer : source.queryFor(
+ ProjectUri.DependencyManagement.Dependencies.Dependency.xUri ) )
+ {
+ managementContainer = new ArtifactModelContainerFactory().create(
+ transformDependencyManagement( managementContainer.getProperties() ) );
+ ModelContainerAction action = dependencyContainer.containerAction( managementContainer );
+ if ( action.equals( ModelContainerAction.JOIN ) || action.equals( ModelContainerAction.DELETE ) )
{
- managementContainer = new ArtifactModelContainerFactory().create(transformDependencyManagement(managementContainer.getProperties()));
- ModelContainerAction action = dependencyContainer.containerAction(managementContainer);
- if(action.equals(ModelContainerAction.JOIN) || action.equals(ModelContainerAction.DELETE)) {
- source.join(dependencyContainer, managementContainer);
- }
+ source.join( dependencyContainer, managementContainer );
}
+ }
}
- for(ModelContainer dependencyContainer : source.queryFor( ProjectUri.Build.Plugins.Plugin.xUri)) {
- for ( ModelContainer managementContainer : source.queryFor( ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri) )
- {
- managementContainer = new ArtifactModelContainerFactory().create(transformPluginManagement(managementContainer.getProperties()));
+ for ( ModelContainer dependencyContainer : source.queryFor( ProjectUri.Build.Plugins.Plugin.xUri ) )
+ {
+ for ( ModelContainer managementContainer : source.queryFor(
+ ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri ) )
+ {
+ managementContainer = new ArtifactModelContainerFactory().create(
+ transformPluginManagement( managementContainer.getProperties() ) );
- //Remove duplicate executions tags
- boolean hasExecutionsTag = false;
- for(ModelProperty mp : dependencyContainer.getProperties()) {
- if(mp.getUri().equals(ProjectUri.Build.Plugins.Plugin.Executions.xUri)) {
- hasExecutionsTag = true;
- break;
- }
- }
- List<ModelProperty> pList = new ArrayList<ModelProperty>();
- if(!hasExecutionsTag) {
- pList = managementContainer.getProperties();
+ //Remove duplicate executions tags
+ boolean hasExecutionsTag = false;
+ for ( ModelProperty mp : dependencyContainer.getProperties() )
+ {
+ if ( mp.getUri().equals( ProjectUri.Build.Plugins.Plugin.Executions.xUri ) )
+ {
+ hasExecutionsTag = true;
+ break;
}
- else
+ }
+ List<ModelProperty> pList = new ArrayList<ModelProperty>();
+ if ( !hasExecutionsTag )
+ {
+ pList = managementContainer.getProperties();
+ }
+ else
+ {
+ for ( ModelProperty mp : managementContainer.getProperties() )
{
- for(ModelProperty mp : managementContainer.getProperties()) {
- if(!mp.getUri().equals(ProjectUri.Build.Plugins.Plugin.Executions.xUri)) {
- pList.add(mp);
- }
+ if ( !mp.getUri().equals( ProjectUri.Build.Plugins.Plugin.Executions.xUri ) )
+ {
+ pList.add( mp );
}
}
- managementContainer = new ArtifactModelContainerFactory().create(pList);
+ }
+ managementContainer = new ArtifactModelContainerFactory().create( pList );
- ModelContainerAction action = dependencyContainer.containerAction(managementContainer);
- if(action.equals(ModelContainerAction.JOIN) || action.equals(ModelContainerAction.DELETE)) {
- source.join(dependencyContainer, managementContainer);
- }
+ ModelContainerAction action = dependencyContainer.containerAction( managementContainer );
+ if ( action.equals( ModelContainerAction.JOIN ) || action.equals( ModelContainerAction.DELETE ) )
+ {
+ source.join( dependencyContainer, managementContainer );
}
+ }
}
-
props = source.getModelProperties();
- //Rule: Do not join plugin executions without ids
- Set<ModelProperty> removeProperties = new HashSet<ModelProperty>();
- ModelDataSource dataSource = new DefaultModelDataSource();
- dataSource.init( props, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
- List<ModelContainer> containers = dataSource.queryFor( ProjectUri.Build.Plugins.Plugin.xUri );
- for (ModelContainer pluginContainer : containers) {
+ //Rule: Do not join plugin executions without ids
+ Set<ModelProperty> removeProperties = new HashSet<ModelProperty>();
+ ModelDataSource dataSource = new DefaultModelDataSource();
+ dataSource.init( props, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
+ List<ModelContainer> containers = dataSource.queryFor( ProjectUri.Build.Plugins.Plugin.xUri );
+ for ( ModelContainer pluginContainer : containers )
+ {
ModelDataSource executionSource = new DefaultModelDataSource();
- executionSource.init( pluginContainer.getProperties(), Arrays.asList( new ArtifactModelContainerFactory(),
- new IdModelContainerFactory() ) );
+ executionSource.init( pluginContainer.getProperties(),
+ Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
List<ModelContainer> executionContainers =
- executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri );
- if(executionContainers.size() < 2)
+ executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri );
+ if ( executionContainers.size() < 2 )
{
continue;
}
boolean hasAtLeastOneWithoutId = true;
- for (ModelContainer executionContainer : executionContainers) {
- if(hasAtLeastOneWithoutId)
+ for ( ModelContainer executionContainer : executionContainers )
+ {
+ if ( hasAtLeastOneWithoutId )
{
- hasAtLeastOneWithoutId = hasExecutionId(executionContainer);
+ hasAtLeastOneWithoutId = hasExecutionId( executionContainer );
}
- if(!hasAtLeastOneWithoutId && !hasExecutionId(executionContainer) && executionContainers.indexOf(executionContainer) > 0)
+ if ( !hasAtLeastOneWithoutId && !hasExecutionId( executionContainer ) &&
+ executionContainers.indexOf( executionContainer ) > 0 )
{
- removeProperties.addAll(executionContainer.getProperties());
+ removeProperties.addAll( executionContainer.getProperties() );
}
}
}
- props.removeAll(removeProperties);
+ props.removeAll( removeProperties );
String xml = null;
try
{
@@ -245,7 +273,7 @@
StringBuffer scmConnectionUrl = new StringBuffer();
StringBuffer scmDeveloperUrl = new StringBuffer();
- boolean containsBuildResources= false;
+ boolean containsBuildResources = false;
boolean containsTestResources = false;
boolean containsPluginRepositories = false;
@@ -409,8 +437,7 @@
{
String uri = mp.getUri();
if ( domainModels.indexOf( domainModel ) > 0 && ( uri.equals( ProjectUri.name ) ||
- uri.equals( ProjectUri.packaging ) || uri.startsWith( ProjectUri.Profiles.xUri )
- ) )
+ uri.equals( ProjectUri.packaging ) || uri.startsWith( ProjectUri.Profiles.xUri ) ) )
{
clearedProperties.add( mp );
}
@@ -420,38 +447,38 @@
//Build Resources Inheritence Rule
//Build Test Resources Inheritance Rule
//Only inherit IF: the above is contained in super pom (domainModels.size() -1) && the child doesn't has it's own respective field
- if(domainModels.indexOf(domainModel) == 0)
+ if ( domainModels.indexOf( domainModel ) == 0 )
{
- containsBuildResources= hasProjectUri(ProjectUri.Build.Resources.xUri, tmp);
- containsTestResources = hasProjectUri(ProjectUri.Build.TestResources.xUri, tmp);
- containsPluginRepositories = hasProjectUri(ProjectUri.PluginRepositories.xUri, tmp);
+ containsBuildResources = hasProjectUri( ProjectUri.Build.Resources.xUri, tmp );
+ containsTestResources = hasProjectUri( ProjectUri.Build.TestResources.xUri, tmp );
+ containsPluginRepositories = hasProjectUri( ProjectUri.PluginRepositories.xUri, tmp );
}
for ( ModelProperty mp : tmp )
{
- if ( domainModels.indexOf( domainModel ) > 0)
+ if ( domainModels.indexOf( domainModel ) > 0 )
{
String uri = mp.getUri();
- boolean isNotSuperPom = domainModels.indexOf(domainModel) != (domainModels.size() -1 );
- if(isNotSuperPom)
+ boolean isNotSuperPom = domainModels.indexOf( domainModel ) != ( domainModels.size() - 1 );
+ if ( isNotSuperPom )
{
- if(uri.startsWith( ProjectUri.Build.Resources.xUri ) ||
- uri.startsWith( ProjectUri.Build.TestResources.xUri ) ||
- uri.startsWith( ProjectUri.PluginRepositories.xUri ) )
+ if ( uri.startsWith( ProjectUri.Build.Resources.xUri ) ||
+ uri.startsWith( ProjectUri.Build.TestResources.xUri ) ||
+ uri.startsWith( ProjectUri.PluginRepositories.xUri ) )
{
clearedProperties.add( mp );
}
}
else
{
- if(containsBuildResources && uri.startsWith( ProjectUri.Build.Resources.xUri ))
+ if ( containsBuildResources && uri.startsWith( ProjectUri.Build.Resources.xUri ) )
{
clearedProperties.add( mp );
}
- else if(containsTestResources && uri.startsWith( ProjectUri.Build.TestResources.xUri ))
+ else if ( containsTestResources && uri.startsWith( ProjectUri.Build.TestResources.xUri ) )
{
clearedProperties.add( mp );
}
- else if(containsPluginRepositories && uri.startsWith( ProjectUri.PluginRepositories.xUri ))
+ else if ( containsPluginRepositories && uri.startsWith( ProjectUri.PluginRepositories.xUri ) )
{
clearedProperties.add( mp );
}
@@ -467,7 +494,7 @@
tmp.removeAll( clearedProperties );
modelProperties.addAll( tmp );
- modelProperties.removeAll(clearedProperties);
+ modelProperties.removeAll( clearedProperties );
if ( domainModels.indexOf( domainModel ) == 0 )
{
@@ -487,11 +514,11 @@
return modelProperties;
}
- private static boolean hasExecutionId(ModelContainer executionContainer)
+ private static boolean hasExecutionId( ModelContainer executionContainer )
{
- for(ModelProperty mp : executionContainer.getProperties() )
+ for ( ModelProperty mp : executionContainer.getProperties() )
{
- if(mp.getUri().equals(ProjectUri.Build.Plugins.Plugin.Executions.Execution.id))
+ if ( mp.getUri().equals( ProjectUri.Build.Plugins.Plugin.Executions.Execution.id ) )
{
return true;
}
@@ -509,11 +536,11 @@
return ProjectUri.baseUri;
}
- private static boolean hasProjectUri(String projectUri, List<ModelProperty> modelProperties)
+ private static boolean hasProjectUri( String projectUri, List<ModelProperty> modelProperties )
{
- for(ModelProperty mp : modelProperties)
+ for ( ModelProperty mp : modelProperties )
{
- if(mp.getUri().equals(projectUri))
+ if ( mp.getUri().equals( projectUri ) )
{
return true;
}
@@ -561,28 +588,33 @@
return null;
}
- private static List<ModelProperty> transformDependencyManagement(List<ModelProperty> modelProperties) {
- List<ModelProperty> transformedProperties = new ArrayList<ModelProperty>();
- for(ModelProperty mp : modelProperties) {
- if(mp.getUri().startsWith(ProjectUri.DependencyManagement.xUri))
- {
- transformedProperties.add(new ModelProperty(
- mp.getUri().replace(ProjectUri.DependencyManagement.xUri, ProjectUri.xUri), mp.getValue()));
- }
+ private static List<ModelProperty> transformDependencyManagement( List<ModelProperty> modelProperties )
+ {
+ List<ModelProperty> transformedProperties = new ArrayList<ModelProperty>();
+ for ( ModelProperty mp : modelProperties )
+ {
+ if ( mp.getUri().startsWith( ProjectUri.DependencyManagement.xUri ) )
+ {
+ transformedProperties.add( new ModelProperty(
+ mp.getUri().replace( ProjectUri.DependencyManagement.xUri, ProjectUri.xUri ), mp.getValue() ) );
}
- return transformedProperties;
}
+ return transformedProperties;
+ }
- public static List<ModelProperty> transformPluginManagement(List<ModelProperty> modelProperties) {
- List<ModelProperty> transformedProperties = new ArrayList<ModelProperty>();
- for(ModelProperty mp : modelProperties) {
- if(mp.getUri().startsWith(ProjectUri.Build.PluginManagement.xUri))
- {
- transformedProperties.add(new ModelProperty(
- mp.getUri().replace(ProjectUri.Build.PluginManagement.xUri, ProjectUri.Build.xUri), mp.getValue()));
- }
+ public static List<ModelProperty> transformPluginManagement( List<ModelProperty> modelProperties )
+ {
+ List<ModelProperty> transformedProperties = new ArrayList<ModelProperty>();
+ for ( ModelProperty mp : modelProperties )
+ {
+ if ( mp.getUri().startsWith( ProjectUri.Build.PluginManagement.xUri ) )
+ {
+ transformedProperties.add( new ModelProperty(
+ mp.getUri().replace( ProjectUri.Build.PluginManagement.xUri, ProjectUri.Build.xUri ),
+ mp.getValue() ) );
}
- return transformedProperties;
}
+ return transformedProperties;
+ }
}
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/Profile.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/Profile.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/Profile.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/Profile.java Mon Sep 8 14:43:31 2008
@@ -1,7 +1,8 @@
package org.apache.maven.project.builder;
-public class Profile {
+public class Profile
+{
+
-
}
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java Mon Sep 8 14:43:31 2008
@@ -42,19 +42,19 @@
/**
* Returns a maven project for the specified input stream.
*
- * @param pom input stream of the model
- * @param inheritedModels list of models containing additional parent models in order from most to least specialized
- * @param interpolatorProperties properties used for interpolation of properties within the model
- * @param resolver artifact resolver used in resolving artifacts
- * @param baseDirectory the base directory of the model
+ * @param pom input stream of the model
+ * @param inheritedModels list of models containing additional parent models in order from most to least specialized
+ * @param interpolatorProperties properties used for interpolation of properties within the model
+ * @param resolver artifact resolver used in resolving artifacts
+ * @param baseDirectory the base directory of the model
* @param projectBuilderConfiguration
* @return a maven project for the specified input stream
* @throws IOException if there is a problem in the construction of the maven project
*/
- MavenProject buildFromLocalPath(InputStream pom, List<Model> inheritedModels,
- Collection<ImportModel> importModels,
- Collection<InterpolatorProperty> interpolatorProperties,
- PomArtifactResolver resolver, File baseDirectory, ProjectBuilderConfiguration projectBuilderConfiguration)
+ MavenProject buildFromLocalPath( InputStream pom, List<Model> inheritedModels, Collection<ImportModel> importModels,
+ Collection<InterpolatorProperty> interpolatorProperties,
+ PomArtifactResolver resolver, File baseDirectory,
+ ProjectBuilderConfiguration projectBuilderConfiguration )
throws IOException;
}
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultImportModel.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultImportModel.java?rev=693291&r1=693290&r2=693291&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultImportModel.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultImportModel.java Mon Sep 8 14:43:31 2008
@@ -6,45 +6,62 @@
import java.util.ArrayList;
import java.util.List;
-public final class DefaultImportModel implements ImportModel {
+public final class DefaultImportModel
+ implements ImportModel
+{
private final String id;
private final List<ModelProperty> modelProperties;
- public DefaultImportModel(String id, List<ModelProperty> modelProperties) {
- if(id == null)
+ public DefaultImportModel( String id, List<ModelProperty> modelProperties )
+ {
+ if ( id == null )
{
- throw new IllegalArgumentException("id: null");
+ throw new IllegalArgumentException( "id: null" );
}
-
- if(modelProperties == null) {
- throw new IllegalArgumentException("modelProperties: null");
+
+ if ( modelProperties == null )
+ {
+ throw new IllegalArgumentException( "modelProperties: null" );
}
this.id = id;
- this.modelProperties = new ArrayList<ModelProperty>(modelProperties);
+ this.modelProperties = new ArrayList<ModelProperty>( modelProperties );
}
- public String getId() {
+ public String getId()
+ {
return id;
}
- public List<ModelProperty> getModelProperties() {
- return new ArrayList<ModelProperty>(modelProperties);
+ public List<ModelProperty> getModelProperties()
+ {
+ return new ArrayList<ModelProperty>( modelProperties );
}
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() )
+ {
+ return false;
+ }
ImportModel that = (ImportModel) o;
- if (id != null ? !id.equals(that.getId()) : that.getId() != null) return false;
+ if ( id != null ? !id.equals( that.getId() ) : that.getId() != null )
+ {
+ return false;
+ }
return true;
}
- public int hashCode() {
- return (id != null ? id.hashCode() : 0);
+ public int hashCode()
+ {
+ return ( id != null ? id.hashCode() : 0 );
}
}