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 2008/06/24 20:46:36 UTC
svn commit: r671291 - in /maven/components/branches/maven-2.0.x: ./
maven-artifact-manager/src/test/java/org/apache/maven/artifact/resolver/
maven-artifact/src/test/java/org/apache/maven/artifact/resolver/
maven-core/src/main/java/org/apache/maven/ mav...
Author: jdcasey
Date: Tue Jun 24 11:46:35 2008
New Revision: 671291
URL: http://svn.apache.org/viewvc?rev=671291&view=rev
Log:
[MNG-3530] Merging dynamicBuild branch to main branch, implementing dynamic build section of the POM.
Added:
maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectDynamismTest.java
- copied unchanged from r671289, maven/components/branches/john-2.0.x-dynamicBuild/maven-project/src/test/java/org/apache/maven/project/MavenProjectDynamismTest.java
maven/components/branches/maven-2.0.x/maven-project/src/test/resources/project-dynamism/
- copied from r671289, maven/components/branches/john-2.0.x-dynamicBuild/maven-project/src/test/resources/project-dynamism/
maven/components/branches/maven-2.0.x/maven-project/src/test/resources/project-dynamism/pom-interp.xml
- copied unchanged from r671289, maven/components/branches/john-2.0.x-dynamicBuild/maven-project/src/test/resources/project-dynamism/pom-interp.xml
maven/components/branches/maven-2.0.x/maven-project/src/test/resources/project-dynamism/pom-relative.xml
- copied unchanged from r671289, maven/components/branches/john-2.0.x-dynamicBuild/maven-project/src/test/resources/project-dynamism/pom-relative.xml
maven/components/branches/maven-2.0.x/maven-project/src/test/resources/project-dynamism/pom.xml
- copied unchanged from r671289, maven/components/branches/john-2.0.x-dynamicBuild/maven-project/src/test/resources/project-dynamism/pom.xml
Modified:
maven/components/branches/maven-2.0.x/build.xml
maven/components/branches/maven-2.0.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
maven/components/branches/maven-2.0.x/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java
maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java
maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java
maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java
maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java
maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java
Modified: maven/components/branches/maven-2.0.x/build.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/build.xml?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/build.xml (original)
+++ maven/components/branches/maven-2.0.x/build.xml Tue Jun 24 11:46:35 2008
@@ -143,6 +143,7 @@
<java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
<classpath refid="maven.classpath"/>
<arg value="-B"/>
+ <arg value="-X"/>
<arg value="clean"/>
<arg value="install"/>
</java>
Modified: maven/components/branches/maven-2.0.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java Tue Jun 24 11:46:35 2008
@@ -29,7 +29,7 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -106,7 +106,7 @@
List remoteRepositories )
throws ArtifactMetadataRetrievalException
{
- Set dependencies = new HashSet();
+ Set dependencies = new LinkedHashSet();
if ( "g".equals( artifact.getArtifactId() ) )
{
@@ -162,7 +162,7 @@
List remoteRepositories )
throws ArtifactMetadataRetrievalException
{
- Set dependencies = new HashSet();
+ Set dependencies = new LinkedHashSet();
if ( "i".equals( artifact.getArtifactId() ) )
{
Modified: maven/components/branches/maven-2.0.x/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java Tue Jun 24 11:46:35 2008
@@ -19,17 +19,6 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
@@ -45,6 +34,17 @@
import org.apache.maven.artifact.versioning.VersionRange;
import org.codehaus.plexus.PlexusTestCase;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* Test the default artifact collector.
*
@@ -69,11 +69,11 @@
{
super.setUp();
- this.source = new Source();
- this.artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
- this.artifactCollector = new DefaultArtifactCollector();
+ source = new Source();
+ artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
+ artifactCollector = new DefaultArtifactCollector();
- this.projectArtifact = createArtifactSpec( "project", "1.0", null );
+ projectArtifact = createArtifactSpec( "project", "1.0", null );
}
// works, but we don't fail on cycles presently
@@ -945,7 +945,7 @@
private ArtifactSpec addDependency( String id, String version, String scope, boolean optional )
throws InvalidVersionSpecificationException
{
- ArtifactSpec dep = createArtifactSpec( id, version, scope, this.artifact.getScope(), optional );
+ ArtifactSpec dep = createArtifactSpec( id, version, scope, artifact.getScope(), optional );
return addDependency( dep );
}
@@ -993,7 +993,7 @@
ArtifactFilter dependencyFilter )
throws InvalidVersionSpecificationException
{
- Set projectArtifacts = new HashSet();
+ Set projectArtifacts = new LinkedHashSet();
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
{
Modified: maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Tue Jun 24 11:46:35 2008
@@ -37,11 +37,9 @@
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.profiles.activation.ProfileActivationException;
-import org.apache.maven.project.DefaultProjectBuilderConfiguration;
import org.apache.maven.project.DuplicateProjectException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.ProjectBuilderConfiguration;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.reactor.MavenExecutionException;
import org.apache.maven.settings.Mirror;
@@ -575,12 +573,7 @@
}
}
- ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
- config.setLocalRepository( request.getLocalRepository() )
- .setGlobalProfileManager( request.getGlobalProfileManager() )
- .setUserProperties( request.getUserProperties() );
-
- return projectBuilder.build( pom, config );
+ return projectBuilder.build( pom, request.getProjectBuilderConfiguration() );
}
// ----------------------------------------------------------------------
@@ -597,7 +590,7 @@
{
return new MavenSession( container, request.getSettings(), request.getLocalRepository(),
request.getEventDispatcher(), rpm, request.getGoals(), request.getBaseDirectory(),
- request.getExecutionProperties(), request.getStartTime() );
+ request.getExecutionProperties(), request.getUserProperties(), request.getStartTime() );
}
/**
Modified: maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java Tue Jun 24 11:46:35 2008
@@ -23,6 +23,8 @@
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.project.DefaultProjectBuilderConfiguration;
+import org.apache.maven.project.ProjectBuilderConfiguration;
import org.apache.maven.settings.Settings;
import java.util.Date;
@@ -204,4 +206,15 @@
{
return userProperties;
}
+
+ public ProjectBuilderConfiguration getProjectBuilderConfiguration()
+ {
+ ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
+ config.setLocalRepository( getLocalRepository() )
+ .setGlobalProfileManager( getGlobalProfileManager() )
+ .setExecutionProperties( getExecutionProperties() )
+ .setUserProperties( getUserProperties() );
+
+ return config;
+ }
}
Modified: maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java Tue Jun 24 11:46:35 2008
@@ -23,6 +23,7 @@
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.project.ProjectBuilderConfiguration;
import org.apache.maven.settings.Settings;
import java.util.Date;
@@ -76,4 +77,6 @@
Date getStartTime();
boolean isShowErrors();
+
+ ProjectBuilderConfiguration getProjectBuilderConfiguration();
}
Modified: maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java Tue Jun 24 11:46:35 2008
@@ -22,7 +22,9 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.DefaultProjectBuilderConfiguration;
import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilderConfiguration;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@@ -57,14 +59,23 @@
private final Properties executionProperties;
+ private Properties userProperties;
+
private final Date startTime;
-
+
private MavenProject currentProject;
public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
EventDispatcher eventDispatcher, ReactorManager reactorManager, List goals,
String executionRootDir, Properties executionProperties, Date startTime )
{
+ this( container, settings, localRepository, eventDispatcher, reactorManager, goals, executionRootDir, executionProperties, null, startTime );
+ }
+
+ public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
+ EventDispatcher eventDispatcher, ReactorManager reactorManager, List goals,
+ String executionRootDir, Properties executionProperties, Properties userProperties, Date startTime )
+ {
this.container = container;
this.settings = settings;
@@ -81,6 +92,8 @@
this.executionProperties = executionProperties;
+ this.userProperties = userProperties;
+
this.startTime = startTime;
}
@@ -171,7 +184,7 @@
{
return startTime;
}
-
+
public void setCurrentProject( MavenProject currentProject )
{
this.currentProject = currentProject;
@@ -184,5 +197,29 @@
{
return currentProject;
}
-
+
+
+ public Properties getUserProperties()
+ {
+ return userProperties;
+ }
+
+ public void setUserProperties( Properties userProperties )
+ {
+ this.userProperties = userProperties;
+ }
+
+ /**
+ * NOTE: This varies from {@link DefaultMavenExecutionRequest#getProjectBuilderConfiguration()} in that
+ * it doesn't supply a global profile manager.
+ */
+ public ProjectBuilderConfiguration getProjectBuilderConfiguration()
+ {
+ ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
+ config.setLocalRepository( getLocalRepository() )
+ .setExecutionProperties( getExecutionProperties() )
+ .setUserProperties( getUserProperties() );
+
+ return config;
+ }
}
\ No newline at end of file
Modified: maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java Tue Jun 24 11:46:35 2008
@@ -19,16 +19,6 @@
* under the License.
*/
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarFile;
-
import org.apache.maven.MavenArtifactFilterManager;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
@@ -63,6 +53,15 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+
/**
* Used to locate extensions.
*
@@ -119,16 +118,15 @@
// We use the same hack here to make sure that plexus 1.1 is available for extensions that do
// not declare plexus-utils but need it. MNG-2900
- DefaultPluginManager.checkPlexusUtils( resolutionGroup, artifactFactory );
-
- Set dependencies = new HashSet( resolutionGroup.getArtifacts() );
+ Set rgArtifacts = resolutionGroup.getArtifacts();
+ rgArtifacts = DefaultPluginManager.checkPlexusUtils( rgArtifacts, artifactFactory );
- dependencies.add( artifact );
+ rgArtifacts.add( artifact );
// Make sure that we do not influence the dependenecy resolution of extensions with the project's
// dependencyManagement
- ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, project.getArtifact(),
+ ArtifactResolutionResult result = artifactResolver.resolveTransitively( rgArtifacts, project.getArtifact(),
Collections.EMPTY_MAP,
//project.getManagedVersionMap(),
localRepository,
@@ -278,7 +276,7 @@
public void contextualize( Context context )
throws ContextException
{
- this.container = (DefaultPlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+ container = (DefaultPlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
private static final class ProjectArtifactExceptionFilter
@@ -292,7 +290,7 @@
Artifact projectArtifact )
{
this.passThroughFilter = passThroughFilter;
- this.projectDependencyConflictId = projectArtifact.getDependencyConflictId();
+ projectDependencyConflictId = projectArtifact.getDependencyConflictId();
}
public boolean include( Artifact artifact )
Modified: maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Tue Jun 24 11:46:35 2008
@@ -20,20 +20,6 @@
* under the License.
*/
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.maven.MavenArtifactFilterManager;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
@@ -71,6 +57,7 @@
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.artifact.MavenMetadataSource;
+import org.apache.maven.project.interpolation.ModelInterpolationException;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.settings.Settings;
@@ -96,6 +83,20 @@
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
public class DefaultPluginManager
extends AbstractLogEnabled
implements PluginManager, Initializable, Contextualizable
@@ -414,10 +415,24 @@
Mojo plugin;
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
+
String goalId = mojoDescriptor.getGoal();
String groupId = pluginDescriptor.getGroupId();
String artifactId = pluginDescriptor.getArtifactId();
String executionId = mojoExecution.getExecutionId();
+
+ if ( !project.isConcrete() )
+ {
+ try
+ {
+ mavenProjectBuilder.calculateConcreteState( project, session.getProjectBuilderConfiguration() );
+ }
+ catch ( ModelInterpolationException e )
+ {
+ throw new PluginManagerException( "Failed to calculate concrete state for project: " + project, e );
+ }
+ }
+
Xpp3Dom dom = project.getGoalConfiguration( groupId, artifactId, executionId, goalId );
Xpp3Dom reportDom = project.getReportConfiguration( groupId, artifactId, executionId );
dom = Xpp3Dom.mergeXpp3Dom( dom, reportDom );
@@ -522,6 +537,15 @@
}
}
}
+
+ try
+ {
+ mavenProjectBuilder.restoreDynamicState( project, session.getProjectBuilderConfiguration() );
+ }
+ catch ( ModelInterpolationException e )
+ {
+ throw new PluginManagerException( "Failed to restore dynamic state for project: " + project, e );
+ }
}
public MavenReport getReport( MavenProject project,
@@ -689,7 +713,9 @@
pluginArtifact.getId() + "': " + e.getMessage(), pluginArtifact, e );
}
- checkPlexusUtils( resolutionGroup, artifactFactory );
+ Set rgArtifacts = resolutionGroup.getArtifacts();
+
+ rgArtifacts = checkPlexusUtils( rgArtifacts, artifactFactory );
// [jdcasey; 20-March-2008]:
// This is meant to eliminate the introduction of duplicated artifacts.
@@ -719,7 +745,7 @@
all.addAll( pluginDescriptor.getIntroducedDependencyArtifacts() );
// add in the deps from the plugin POM now.
- all.addAll( resolutionGroup.getArtifacts() );
+ all.addAll( rgArtifacts );
for ( Iterator it = all.iterator(); it.hasNext(); )
{
@@ -831,7 +857,7 @@
}
}
- public static void checkPlexusUtils( ResolutionGroup resolutionGroup, ArtifactFactory artifactFactory )
+ public static Set checkPlexusUtils( Set dependencyArtifacts, ArtifactFactory artifactFactory )
{
// ----------------------------------------------------------------------------
// If the plugin already declares a dependency on plexus-utils then we're all
@@ -856,7 +882,7 @@
boolean plexusUtilsPresent = false;
- for ( Iterator i = resolutionGroup.getArtifacts().iterator(); i.hasNext(); )
+ for ( Iterator i = dependencyArtifacts.iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
@@ -875,9 +901,19 @@
// version to the latest version we know that works as of the 2.0.6 release. We set the scope to runtime
// as this is what's implicitly happening in 2.0.6.
- resolutionGroup.getArtifacts().add( artifactFactory.createArtifact( "org.codehaus.plexus",
- "plexus-utils", "1.1",
- Artifact.SCOPE_RUNTIME, "jar" ) );
+ Set result = new LinkedHashSet();
+ if ( !dependencyArtifacts.isEmpty() )
+ {
+ result.addAll( dependencyArtifacts );
+ }
+
+ result.add( artifactFactory.createArtifact( "org.codehaus.plexus", "plexus-utils", "1.1", Artifact.SCOPE_RUNTIME, "jar" ) );
+
+ return result;
+ }
+ else
+ {
+ return dependencyArtifacts;
}
}
@@ -1408,7 +1444,7 @@
{
project.setDependencyArtifacts( project.createArtifacts( artifactFactory, null, null ) );
}
-
+
Set resolvedArtifacts;
try
{
@@ -1423,7 +1459,7 @@
catch (MultipleArtifactsNotFoundException me)
{
/*only do this if we are an aggregating plugin: MNG-2277
- if the dependency doesn't yet exist but is in the reactor, then
+ if the dependency doesn't yet exist but is in the reactor, then
all we can do is warn and skip it. A better fix can be inserted into 2.1*/
if (isAggregator && checkMissingArtifactsInReactor( context.getSortedProjects(), me.getMissingArtifacts() ))
{
@@ -1466,19 +1502,19 @@
//most likely it would be produced by the project we just found in the reactor since all
//the other info matches. Assume it's ok.
getLogger().warn( "The dependency: "+ p.getId()+" can't be resolved but has been found in the reactor.\nThis dependency has been excluded from the plugin execution. You should rerun this mojo after executing mvn install.\n" );
-
+
//found it, move on.
foundInReactor.add( p );
break;
- }
+ }
}
}
-
+
//if all of them have been found, we can continue.
return foundInReactor.size() == missing.size();
}
-
-
+
+
// ----------------------------------------------------------------------
// Artifact downloading
// ----------------------------------------------------------------------
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Tue Jun 24 11:46:35 2008
@@ -46,9 +46,11 @@
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.Profile;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.Repository;
+import org.apache.maven.model.Resource;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.MavenProfilesBuilder;
@@ -893,10 +895,6 @@
// this only happens if we are building from a source file
if ( projectDescriptor != null )
{
- // Only translate the base directory for files in the source tree
- pathTranslator.alignToBaseDirectory( project.getModel(),
- projectDir );
-
Build build = project.getBuild();
project.addCompileSourceRoot( build.getSourceDirectory() );
@@ -909,6 +907,15 @@
project.setFile( projectDescriptor );
}
+// try
+// {
+// calculateConcreteState( project, config );
+// }
+// catch ( ModelInterpolationException e )
+// {
+// throw new InvalidProjectModelException( projectId, pomLocation, e.getMessage(), e );
+// }
+
project.setManagedVersionMap( createManagedVersionMap( projectId,
project.getDependencyManagement(),
project.getParent() ) );
@@ -983,46 +990,15 @@
activeProfiles.addAll( injectedProfiles );
- // We don't need all the project methods that are added over those in the model, but we do need basedir
- Map context = new HashMap();
-
- Build build = model.getBuild();
-
- if ( projectDir != null )
- {
- context.put( "basedir", projectDir.getAbsolutePath() );
-
- // MNG-1927, MNG-2124, MNG-3355:
- // If the build section is present and the project directory is non-null, we should make
- // sure interpolation of the directories below uses translated paths.
- // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the
- // code below...
- context.put( "build.directory", pathTranslator.alignToBaseDirectory( build.getDirectory(), projectDir ) );
- context.put( "build.outputDirectory", pathTranslator.alignToBaseDirectory( build.getOutputDirectory(), projectDir ) );
- context.put( "build.testOutputDirectory", pathTranslator.alignToBaseDirectory( build.getTestOutputDirectory(), projectDir ) );
- context.put( "build.sourceDirectory", pathTranslator.alignToBaseDirectory( build.getSourceDirectory(), projectDir ) );
- context.put( "build.testSourceDirectory", pathTranslator.alignToBaseDirectory( build.getTestSourceDirectory(), projectDir ) );
- }
+ Build dynamicBuild = model.getBuild();
- if ( !isSuperPom )
- {
- Properties userProps = config.getUserProperties();
- if ( userProps != null )
- {
- context.putAll( userProps );
- }
- }
+ model.setBuild( ModelUtils.cloneBuild( dynamicBuild ) );
- model = modelInterpolator.interpolate( model, context, strict );
+ model = interpolate( model, projectDir, isSuperPom, config, strict );
- // second pass allows ${user.home} to work, if it needs to.
- // [MNG-2339] ensure the system properties are still interpolated for backwards compat, but the model values must win
- if ( config.getExecutionProperties() != null && !config.getExecutionProperties().isEmpty() )
- {
- context.putAll( config.getExecutionProperties() );
- }
+ mergeDeterministicBuildElements( model.getBuild(), dynamicBuild );
- model = modelInterpolator.interpolate( model, context, strict );
+ model.setBuild( dynamicBuild );
// MNG-3482: Make sure depMgmt is interpolated before merging.
if ( !isSuperPom )
@@ -1122,6 +1098,106 @@
return project;
}
+ private Model interpolate( Model model,
+ File projectDir,
+ boolean isSuperPom,
+ ProjectBuilderConfiguration config,
+ boolean strict )
+ throws ModelInterpolationException
+ {
+ // We don't need all the project methods that are added over those in the model, but we do need basedir
+ Map context = new HashMap();
+
+ Build build = model.getBuild();
+
+ if ( projectDir != null )
+ {
+ context.put( "basedir", projectDir.getAbsolutePath() );
+
+ // MNG-1927, MNG-2124, MNG-3355:
+ // If the build section is present and the project directory is non-null, we should make
+ // sure interpolation of the directories below uses translated paths.
+ // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the
+ // code below...
+ context.put( "build.directory", pathTranslator.alignToBaseDirectory( build.getDirectory(), projectDir ) );
+ context.put( "build.outputDirectory", pathTranslator.alignToBaseDirectory( build.getOutputDirectory(), projectDir ) );
+ context.put( "build.testOutputDirectory", pathTranslator.alignToBaseDirectory( build.getTestOutputDirectory(), projectDir ) );
+ context.put( "build.sourceDirectory", pathTranslator.alignToBaseDirectory( build.getSourceDirectory(), projectDir ) );
+ context.put( "build.testSourceDirectory", pathTranslator.alignToBaseDirectory( build.getTestSourceDirectory(), projectDir ) );
+ }
+
+ if ( !isSuperPom )
+ {
+ Properties userProps = config.getUserProperties();
+ if ( userProps != null )
+ {
+ getLogger().debug( "Using user-defined properties for interpolation:\n" + String.valueOf( userProps ).replace( ',', '\n' ) );
+ context.putAll( userProps );
+ }
+ }
+
+ model = modelInterpolator.interpolate( model, context, strict );
+
+ // second pass allows ${user.home} to work, if it needs to.
+ // [MNG-2339] ensure the system properties are still interpolated for backwards compat, but the model values must win
+ if ( config.getExecutionProperties() != null && !config.getExecutionProperties().isEmpty() )
+ {
+ context.putAll( config.getExecutionProperties() );
+ }
+
+ model = modelInterpolator.interpolate( model, context, strict );
+
+ return model;
+ }
+
+ private void mergeDeterministicBuildElements( Build interpolatedBuild,
+ Build dynamicBuild )
+ {
+ List dPlugins = dynamicBuild.getPlugins();
+
+ if ( dPlugins != null )
+ {
+ List iPlugins = interpolatedBuild.getPlugins();
+
+ for ( int i = 0; i < dPlugins.size(); i++ )
+ {
+ Plugin dPlugin = (Plugin) dPlugins.get( i );
+ Plugin iPlugin = (Plugin) iPlugins.get( i );
+
+ dPlugin.setGroupId( iPlugin.getGroupId() );
+ dPlugin.setArtifactId( iPlugin.getArtifactId() );
+ dPlugin.setVersion( iPlugin.getVersion() );
+ }
+ }
+
+ PluginManagement dPluginMgmt = dynamicBuild.getPluginManagement();
+
+ if ( dPluginMgmt != null )
+ {
+ PluginManagement iPluginMgmt = interpolatedBuild.getPluginManagement();
+ dPlugins = dPluginMgmt.getPlugins();
+ if ( dPlugins != null )
+ {
+ List iPlugins = iPluginMgmt.getPlugins();
+
+ for ( int i = 0; i < dPlugins.size(); i++ )
+ {
+ Plugin dPlugin = (Plugin) dPlugins.get( i );
+ Plugin iPlugin = (Plugin) iPlugins.get( i );
+
+ dPlugin.setGroupId( iPlugin.getGroupId() );
+ dPlugin.setArtifactId( iPlugin.getArtifactId() );
+ dPlugin.setVersion( iPlugin.getVersion() );
+ }
+ }
+ }
+
+ if ( dynamicBuild.getExtensions() != null )
+ {
+ dynamicBuild.setExtensions( interpolatedBuild.getExtensions() );
+ }
+ }
+
/**
* @noinspection CollectionDeclaredAsConcreteClass
* @todo We need to find an effective way to unit test parts of this method!
@@ -1778,4 +1854,511 @@
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
+ public void calculateConcreteState( MavenProject project, ProjectBuilderConfiguration config )
+ throws ModelInterpolationException
+ {
+ if ( project.isConcrete() )
+ {
+ return;
+ }
+
+ Model model = ModelUtils.cloneModel( project.getModel() );
+
+ // We don't need all the project methods that are added over those in the model, but we do need basedir
+ Map context = new HashMap();
+
+ boolean isSuperPom = project.getGroupId().equals( STANDALONE_SUPERPOM_GROUPID )
+ && project.getArtifactId().equals( STANDALONE_SUPERPOM_ARTIFACTID )
+ && project.getVersion().equals( STANDALONE_SUPERPOM_VERSION );
+
+ File basedir = project.getBasedir();
+
+ model = interpolate( model, basedir, isSuperPom, config, true );
+
+ List originalInterpolatedCompileSourceRoots = interpolateListOfStrings( project.getCompileSourceRoots(),
+ model,
+ context );
+
+ project.preserveCompileSourceRoots( originalInterpolatedCompileSourceRoots );
+
+ project.setCompileSourceRoots( originalInterpolatedCompileSourceRoots == null ? null
+ : translateListOfPaths( originalInterpolatedCompileSourceRoots, basedir ) );
+
+ List originalInterpolatedTestCompileSourceRoots = interpolateListOfStrings( project.getTestCompileSourceRoots(),
+ model,
+ context );
+
+ project.preserveTestCompileSourceRoots( originalInterpolatedTestCompileSourceRoots );
+ project.setTestCompileSourceRoots( originalInterpolatedTestCompileSourceRoots == null ? null
+ : translateListOfPaths( originalInterpolatedTestCompileSourceRoots, basedir ) );
+
+ List originalInterpolatedScriptSourceRoots = interpolateListOfStrings( project.getScriptSourceRoots(),
+ model,
+ context );
+
+ project.preserveScriptSourceRoots( originalInterpolatedScriptSourceRoots );
+ project.setScriptSourceRoots( originalInterpolatedScriptSourceRoots == null ? null
+ : translateListOfPaths( originalInterpolatedScriptSourceRoots, basedir ) );
+
+ Model model2 = ModelUtils.cloneModel( model );
+
+ pathTranslator.alignToBaseDirectory( model, basedir );
+
+ project.preserveBuild( model2.getBuild() );
+ project.setBuild( model.getBuild() );
+
+ calculateConcreteProjectReferences( project, config );
+
+ if ( project.getExecutionProject() != null )
+ {
+ calculateConcreteState( project.getExecutionProject(), config );
+ }
+
+ project.setConcrete( true );
+ }
+
+ private void calculateConcreteProjectReferences( MavenProject project,
+ ProjectBuilderConfiguration config )
+ throws ModelInterpolationException
+ {
+ Map projectRefs = project.getProjectReferences();
+
+ if ( projectRefs != null )
+ {
+ for ( Iterator it = projectRefs.values().iterator(); it.hasNext(); )
+ {
+ MavenProject reference = (MavenProject) it.next();
+ calculateConcreteState( reference, config );
+ }
+ }
+ }
+
+ private List translateListOfPaths( List paths, File basedir )
+ {
+ if ( paths == null )
+ {
+ return null;
+ }
+ else if ( basedir == null )
+ {
+ return paths;
+ }
+
+ List result = new ArrayList( paths.size() );
+ for ( Iterator it = paths.iterator(); it.hasNext(); )
+ {
+ String path = (String) it.next();
+
+ String aligned = pathTranslator.alignToBaseDirectory( path, basedir );
+
+ result.add( aligned );
+ }
+
+ return result;
+ }
+
+ public void restoreDynamicState( MavenProject project, ProjectBuilderConfiguration config )
+ throws ModelInterpolationException
+ {
+ if ( !project.isConcrete() )
+ {
+ return;
+ }
+
+ Build changedBuild = project.getBuild();
+
+ Map context = new HashMap();
+ populateBuildPaths( changedBuild, context, project.getBasedir() );
+ populateExecutionProperties( config, context );
+
+ restoreBuildRoots( project, config, context );
+ restoreModelBuildSection( project, config, context );
+
+ restoreDynamicProjectReferences( project, config );
+ if ( project.getExecutionProject() != null )
+ {
+ restoreDynamicState( project.getExecutionProject(), config );
+ }
+
+ project.setConcrete( false );
+ }
+
+ private void restoreDynamicProjectReferences( MavenProject project,
+ ProjectBuilderConfiguration config )
+ throws ModelInterpolationException
+ {
+ Map projectRefs = project.getProjectReferences();
+ if ( projectRefs != null )
+ {
+ for ( Iterator it = projectRefs.values().iterator(); it.hasNext(); )
+ {
+ MavenProject projectRef = (MavenProject) it.next();
+ restoreDynamicState( projectRef, config );
+ }
+ }
+ }
+
+ private void restoreBuildRoots( MavenProject project,
+ ProjectBuilderConfiguration config,
+ Map context )
+ throws ModelInterpolationException
+ {
+ project.setCompileSourceRoots( restoreListOfStrings( project.getDynamicCompileSourceRoots(),
+ project.getOriginalInterpolatedCompileSourceRoots(),
+ project.getCompileSourceRoots(),
+ project,
+ context ) );
+
+ project.setTestCompileSourceRoots( restoreListOfStrings( project.getDynamicTestCompileSourceRoots(),
+ project.getOriginalInterpolatedTestCompileSourceRoots(),
+ project.getTestCompileSourceRoots(),
+ project,
+ context ) );
+
+ project.setScriptSourceRoots( restoreListOfStrings( project.getDynamicScriptSourceRoots(),
+ project.getOriginalInterpolatedScriptSourceRoots(),
+ project.getScriptSourceRoots(),
+ project,
+ context ) );
+
+ project.clearRestorableRoots();
+ }
+
+ private void restoreModelBuildSection( MavenProject project,
+ ProjectBuilderConfiguration config,
+ Map context )
+ throws ModelInterpolationException
+ {
+ Build changedBuild = project.getBuild();
+ Build dynamicBuild = project.getDynamicBuild();
+ Build originalInterpolatedBuild = project.getOriginalInterpolatedBuild();
+
+ dynamicBuild.setResources( restoreResources( dynamicBuild.getResources(),
+ originalInterpolatedBuild.getResources(),
+ changedBuild.getResources(),
+ project,
+ context ) );
+
+ dynamicBuild.setTestResources( restoreResources( dynamicBuild.getTestResources(),
+ originalInterpolatedBuild.getTestResources(),
+ changedBuild.getTestResources(),
+ project,
+ context ) );
+
+ dynamicBuild.setFilters( restoreListOfStrings( dynamicBuild.getFilters(),
+ originalInterpolatedBuild.getFilters(),
+ changedBuild.getFilters(),
+ project,
+ context ) );
+
+ dynamicBuild.setFinalName( restoreString( dynamicBuild.getFinalName(),
+ originalInterpolatedBuild.getFinalName(),
+ changedBuild.getFinalName(),
+ project,
+ context ) );
+
+ dynamicBuild.setDefaultGoal( restoreString( dynamicBuild.getDefaultGoal(),
+ originalInterpolatedBuild.getDefaultGoal(),
+ changedBuild.getDefaultGoal(),
+ project,
+ context ) );
+
+ dynamicBuild.setSourceDirectory( restoreString( dynamicBuild.getSourceDirectory(),
+ originalInterpolatedBuild.getSourceDirectory(),
+ changedBuild.getSourceDirectory(),
+ project,
+ context ) );
+
+ dynamicBuild.setTestSourceDirectory( restoreString( dynamicBuild.getTestSourceDirectory(),
+ originalInterpolatedBuild.getTestSourceDirectory(),
+ changedBuild.getTestSourceDirectory(),
+ project,
+ context ) );
+
+ dynamicBuild.setScriptSourceDirectory( restoreString( dynamicBuild.getScriptSourceDirectory(),
+ originalInterpolatedBuild.getScriptSourceDirectory(),
+ changedBuild.getScriptSourceDirectory(),
+ project,
+ context ) );
+
+ dynamicBuild.setOutputDirectory( restoreString( dynamicBuild.getOutputDirectory(),
+ originalInterpolatedBuild.getOutputDirectory(),
+ changedBuild.getOutputDirectory(),
+ project,
+ context ) );
+
+ dynamicBuild.setTestOutputDirectory( restoreString( dynamicBuild.getTestOutputDirectory(),
+ originalInterpolatedBuild.getTestOutputDirectory(),
+ changedBuild.getTestOutputDirectory(),
+ project,
+ context ) );
+
+ dynamicBuild.setDirectory( restoreString( dynamicBuild.getDirectory(),
+ originalInterpolatedBuild.getDirectory(),
+ changedBuild.getDirectory(),
+ project,
+ context ) );
+
+ project.setBuild( dynamicBuild );
+
+ project.clearRestorableBuild();
+ }
+
+ private List interpolateListOfStrings( List originalStrings,
+ Model model,
+ Map context )
+ throws ModelInterpolationException
+ {
+ if ( originalStrings == null )
+ {
+ return null;
+ }
+
+ List result = new ArrayList();
+
+ for ( Iterator it = originalStrings.iterator(); it.hasNext(); )
+ {
+ String original = (String) it.next();
+ String interpolated = modelInterpolator.interpolate( original, model, context );
+
+ result.add( interpolated );
+ }
+
+ return result;
+ }
+
+ private String restoreString( String originalString,
+ String originalInterpolatedString,
+ String changedString,
+ MavenProject project,
+ Map context )
+ throws ModelInterpolationException
+ {
+ if ( originalString == null )
+ {
+ return changedString;
+ }
+ else if ( changedString == null )
+ {
+ return originalString;
+ }
+
+ Model model = project.getModel();
+
+ String relativeChangedString;
+ if ( project.getBasedir() != null )
+ {
+ relativeChangedString = pathTranslator.unalignFromBaseDirectory( changedString, project.getBasedir() );
+ }
+ else
+ {
+ relativeChangedString = changedString;
+ }
+
+ String interpolatedOriginal = modelInterpolator.interpolate( originalString, model, context );
+ String interpolatedOriginal2 = modelInterpolator.interpolate( originalInterpolatedString,
+ model,
+ context );
+
+ String interpolatedChanged = modelInterpolator.interpolate( changedString, model, context );
+ String relativeInterpolatedChanged = modelInterpolator.interpolate( relativeChangedString, model, context );
+
+ if ( interpolatedOriginal.equals( interpolatedChanged )
+ || interpolatedOriginal2.equals( interpolatedChanged ) )
+ {
+ return originalString;
+ }
+ else if ( interpolatedOriginal.equals( relativeInterpolatedChanged )
+ || interpolatedOriginal2.equals( relativeInterpolatedChanged ) )
+ {
+ return originalString;
+ }
+
+ return relativeChangedString;
+ }
+
+ private List restoreListOfStrings( List originalStrings,
+ List originalInterpolatedStrings,
+ List changedStrings,
+ MavenProject project,
+ Map context )
+ throws ModelInterpolationException
+ {
+ if ( originalStrings == null )
+ {
+ return changedStrings;
+ }
+ else if ( changedStrings == null )
+ {
+ return originalStrings;
+ }
+
+ List result = new ArrayList();
+
+ Map orig = new HashMap();
+ for ( int idx = 0; idx < originalStrings.size(); idx++ )
+ {
+ String[] permutations = new String[2];
+
+ permutations[0] = (String) originalInterpolatedStrings.get( idx );
+ permutations[1] = (String) originalStrings.get( idx );
+
+ orig.put( permutations[0], permutations );
+ }
+
+ for ( Iterator it = changedStrings.iterator(); it.hasNext(); )
+ {
+ String changedString = (String) it.next();
+ String relativeChangedString;
+ if ( project.getBasedir() != null )
+ {
+ relativeChangedString = pathTranslator.unalignFromBaseDirectory( changedString, project.getBasedir() );
+ }
+ else
+ {
+ relativeChangedString = changedString;
+ }
+
+ String interpolated = modelInterpolator.interpolate( changedString, project.getModel(), orig );
+ String relativeInterpolated = modelInterpolator.interpolate( relativeChangedString, project.getModel(), orig );
+
+ String[] original = (String[]) orig.get( interpolated );
+ if ( original == null )
+ {
+ original = (String[]) orig.get( relativeInterpolated );
+ }
+
+ if ( original == null )
+ {
+ result.add( relativeChangedString );
+ }
+ else
+ {
+ result.add( original[1] );
+ }
+ }
+
+ return result;
+ }
+
+ private List restoreResources( List originalResources,
+ List originalInterpolatedResources,
+ List changedResources,
+ MavenProject project,
+ Map context )
+ throws ModelInterpolationException
+ {
+ if ( originalResources == null || changedResources == null )
+ {
+ return originalResources;
+ }
+
+ List result = new ArrayList();
+
+ Map orig = new HashMap();
+ for ( int idx = 0; idx < originalResources.size(); idx++ )
+ {
+ Resource[] permutations = new Resource[2];
+
+ permutations[0] = (Resource) originalInterpolatedResources.get( idx );
+ permutations[1] = (Resource) originalResources.get( idx );
+
+ orig.put( permutations[0].getDirectory(), permutations );
+ }
+
+ for ( Iterator it = changedResources.iterator(); it.hasNext(); )
+ {
+ Resource resource = (Resource) it.next();
+ String rDir = modelInterpolator.interpolate( resource.getDirectory(), project.getModel(), orig );
+
+ String relativeDir;
+ if ( project.getBasedir() != null )
+ {
+ relativeDir = pathTranslator.unalignFromBaseDirectory( resource.getDirectory(),
+ project.getBasedir() );
+ }
+ else
+ {
+ relativeDir = resource.getDirectory();
+ }
+
+ String relativeRDir = modelInterpolator.interpolate( relativeDir, project.getModel(), context );
+
+ Resource[] original = (Resource[]) orig.get( rDir );
+ if ( original == null )
+ {
+ original = (Resource[]) orig.get( relativeRDir );
+ }
+
+ if ( original == null )
+ {
+ result.add( resource );
+ }
+ else
+ {
+ // TODO: Synchronize all non-directory fields, such as targetPath, includes, and excludes.
+// String target = interpolator.interpolate( resource.getTargetPath(), model, context );
+// String oTarget = interpolator.interpolate( originalResource.getTargetPath(), model, context );
+
+ result.add( original[1] );
+ }
+ }
+
+ return result;
+ }
+
+ private void populateExecutionProperties( ProjectBuilderConfiguration config,
+ Map context )
+ {
+ // second pass allows ${user.home} to work, if it needs to.
+ // [MNG-2339] ensure the system properties are still interpolated for backwards compat, but the model values must win
+ if ( config.getExecutionProperties() != null
+ && !config.getExecutionProperties().isEmpty() )
+ {
+ for ( Iterator it = config.getExecutionProperties().entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+
+ String key = (String) entry.getKey();
+ if ( "basedir".equals( key ) )
+ {
+ continue;
+ }
+ else
+ {
+ context.put( key, entry.getValue() );
+ }
+ }
+ }
+ }
+
+ private void populateBuildPaths( Build build,
+ Map context,
+ File projectDir )
+ {
+ if ( projectDir != null )
+ {
+ context.put( "basedir", projectDir.getAbsolutePath() );
+
+ // MNG-1927, MNG-2124, MNG-3355:
+ // If the build section is present and the project directory is non-null, we should make
+ // sure interpolation of the directories below uses translated paths.
+ // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the
+ // code below...
+// context.put( "build.directory",
+// pathTranslator.alignToBaseDirectory( build.getDirectory(), projectDir ) );
+// context.put( "build.outputDirectory",
+// pathTranslator.alignToBaseDirectory( build.getOutputDirectory(),
+// projectDir ) );
+// context.put( "build.testOutputDirectory",
+// pathTranslator.alignToBaseDirectory( build.getTestOutputDirectory(),
+// projectDir ) );
+// context.put( "build.sourceDirectory",
+// pathTranslator.alignToBaseDirectory( build.getSourceDirectory(),
+// projectDir ) );
+// context.put( "build.testSourceDirectory",
+// pathTranslator.alignToBaseDirectory( build.getTestSourceDirectory(),
+// projectDir ) );
+ }
+ }
}
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Tue Jun 24 11:46:35 2008
@@ -280,6 +280,35 @@
{
setSnapshotArtifactRepository( project.getSnapshotArtifactRepository() );
}
+
+ if ( project.isConcrete() )
+ {
+ setDynamicBuild( ModelUtils.cloneBuild( project.getDynamicBuild() ) );
+ setOriginalInterpolatedBuild( ModelUtils.cloneBuild( project.getOriginalInterpolatedBuild() ) );
+
+ List dynamicRoots = project.getDynamicCompileSourceRoots();
+ if ( dynamicRoots != null )
+ {
+ setDynamicCompileSourceRoots( new ArrayList( dynamicRoots ) );
+ setOriginalInterpolatedCompileSourceRoots( new ArrayList( project.getOriginalInterpolatedCompileSourceRoots() ) );
+ }
+
+ dynamicRoots = project.getDynamicTestCompileSourceRoots();
+ if ( dynamicRoots != null )
+ {
+ setDynamicTestCompileSourceRoots( new ArrayList( dynamicRoots ) );
+ setOriginalInterpolatedTestCompileSourceRoots( new ArrayList( project.getOriginalInterpolatedTestCompileSourceRoots() ) );
+ }
+
+ dynamicRoots = project.getDynamicScriptSourceRoots();
+ if ( dynamicRoots != null )
+ {
+ setDynamicScriptSourceRoots( new ArrayList( dynamicRoots ) );
+ setOriginalInterpolatedScriptSourceRoots( new ArrayList( project.getOriginalInterpolatedScriptSourceRoots() ) );
+ }
+ }
+
+ setConcrete( project.isConcrete() );
}
public String getModulePathAdjustment( MavenProject moduleProject ) throws IOException
@@ -1583,7 +1612,7 @@
projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project );
}
- private static String getProjectReferenceId( String groupId, String artifactId, String version )
+ public static String getProjectReferenceId( String groupId, String artifactId, String version )
{
return groupId + ":" + artifactId + ":" + version;
}
@@ -1795,4 +1824,159 @@
return clone;
}
+// ----------------------------------------------------------------------------
+// CODE BELOW IS USED TO PRESERVE DYNAMISM IN THE BUILD SECTION OF THE POM.
+// ----------------------------------------------------------------------------
+
+ private Build dynamicBuild;
+
+ private Build originalInterpolatedBuild;
+
+ private List dynamicCompileSourceRoots;
+
+ private List originalInterpolatedCompileSourceRoots;
+
+ private List dynamicTestCompileSourceRoots;
+
+ private List originalInterpolatedTestCompileSourceRoots;
+
+ private List dynamicScriptSourceRoots;
+
+ private List originalInterpolatedScriptSourceRoots;
+
+ private boolean isConcrete = false;
+
+ public boolean isConcrete()
+ {
+ return isConcrete;
+ }
+
+ public void setConcrete( boolean concrete )
+ {
+ isConcrete = concrete;
+ }
+
+ public Build getDynamicBuild()
+ {
+ return dynamicBuild;
+ }
+
+ public Build getOriginalInterpolatedBuild()
+ {
+ return originalInterpolatedBuild;
+ }
+
+ public List getDynamicCompileSourceRoots()
+ {
+ return dynamicCompileSourceRoots;
+ }
+
+ public List getOriginalInterpolatedCompileSourceRoots()
+ {
+ return originalInterpolatedCompileSourceRoots;
+ }
+
+ public List getDynamicTestCompileSourceRoots()
+ {
+ return dynamicTestCompileSourceRoots;
+ }
+
+ public List getOriginalInterpolatedTestCompileSourceRoots()
+ {
+ return originalInterpolatedTestCompileSourceRoots;
+ }
+
+ public List getDynamicScriptSourceRoots()
+ {
+ return dynamicScriptSourceRoots;
+ }
+
+ public List getOriginalInterpolatedScriptSourceRoots()
+ {
+ return originalInterpolatedScriptSourceRoots;
+ }
+
+ public void clearRestorableRoots()
+ {
+ dynamicCompileSourceRoots = null;
+ dynamicTestCompileSourceRoots = null;
+ dynamicScriptSourceRoots = null;
+ originalInterpolatedCompileSourceRoots = null;
+ originalInterpolatedScriptSourceRoots = null;
+ originalInterpolatedTestCompileSourceRoots = null;
+ }
+
+ public void clearRestorableBuild()
+ {
+ dynamicBuild = null;
+ originalInterpolatedBuild = null;
+ }
+
+ public void preserveCompileSourceRoots( List originalInterpolatedCompileSourceRoots )
+ {
+ dynamicCompileSourceRoots = getCompileSourceRoots();
+ this.originalInterpolatedCompileSourceRoots = originalInterpolatedCompileSourceRoots;
+ }
+
+ public void preserveTestCompileSourceRoots( List originalInterpolatedTestCompileSourceRoots )
+ {
+ dynamicTestCompileSourceRoots = getTestCompileSourceRoots();
+ this.originalInterpolatedTestCompileSourceRoots = originalInterpolatedTestCompileSourceRoots;
+ }
+
+ public void preserveScriptSourceRoots( List originalInterpolatedScriptSourceRoots )
+ {
+ dynamicScriptSourceRoots = getScriptSourceRoots();
+ this.originalInterpolatedScriptSourceRoots = originalInterpolatedScriptSourceRoots;
+ }
+
+ public void preserveBuild( Build originalInterpolatedBuild )
+ {
+ dynamicBuild = getBuild();
+ this.originalInterpolatedBuild = originalInterpolatedBuild;
+
+ this.originalInterpolatedBuild.setPluginManagement( null );
+ this.originalInterpolatedBuild.setPlugins( null );
+ }
+
+ protected void setDynamicBuild( Build dynamicBuild )
+ {
+ this.dynamicBuild = dynamicBuild;
+ }
+
+ protected void setOriginalInterpolatedBuild( Build originalInterpolatedBuild )
+ {
+ this.originalInterpolatedBuild = originalInterpolatedBuild;
+ }
+
+ protected void setDynamicCompileSourceRoots( List dynamicCompileSourceRoots )
+ {
+ this.dynamicCompileSourceRoots = dynamicCompileSourceRoots;
+ }
+
+ protected void setOriginalInterpolatedCompileSourceRoots( List originalInterpolatedCompileSourceRoots )
+ {
+ this.originalInterpolatedCompileSourceRoots = originalInterpolatedCompileSourceRoots;
+ }
+
+ protected void setDynamicTestCompileSourceRoots( List dynamicTestCompileSourceRoots )
+ {
+ this.dynamicTestCompileSourceRoots = dynamicTestCompileSourceRoots;
+ }
+
+ protected void setOriginalInterpolatedTestCompileSourceRoots( List originalInterpolatedTestCompileSourceRoots )
+ {
+ this.originalInterpolatedTestCompileSourceRoots = originalInterpolatedTestCompileSourceRoots;
+ }
+
+ protected void setDynamicScriptSourceRoots( List dynamicScriptSourceRoots )
+ {
+ this.dynamicScriptSourceRoots = dynamicScriptSourceRoots;
+ }
+
+ protected void setOriginalInterpolatedScriptSourceRoots( List originalInterpolatedScriptSourceRoots )
+ {
+ this.originalInterpolatedScriptSourceRoots = originalInterpolatedScriptSourceRoots;
+ }
+
}
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java Tue Jun 24 11:46:35 2008
@@ -24,6 +24,7 @@
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.project.interpolation.ModelInterpolationException;
import org.apache.maven.wagon.events.TransferListener;
import java.io.File;
@@ -113,4 +114,14 @@
ProjectBuilderConfiguration config,
boolean checkDistributionManagementStatus )
throws ProjectBuildingException;
+
+ // ----------------------------------------------------------------------------
+ // API BELOW IS USED TO PRESERVE DYNAMISM IN THE BUILD SECTION OF THE POM.
+ // ----------------------------------------------------------------------------
+
+ void calculateConcreteState( MavenProject project, ProjectBuilderConfiguration config )
+ throws ModelInterpolationException;
+
+ void restoreDynamicState( MavenProject project, ProjectBuilderConfiguration config )
+ throws ModelInterpolationException;
}
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java Tue Jun 24 11:46:35 2008
@@ -581,6 +581,17 @@
return newModel;
}
+ public static Build cloneBuild( Build build )
+ {
+ ModelInheritanceAssembler assembler = new DefaultModelInheritanceAssembler();
+
+ Build clone = new Build();
+
+ assembler.assembleBuildInheritance( clone, build );
+
+ return clone;
+ }
+
private static List cloneProfiles( List profiles )
{
if ( profiles == null )
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java Tue Jun 24 11:46:35 2008
@@ -289,83 +289,89 @@
child.setBuild( childBuild );
}
- // The build has been set but we want to step in here and fill in
- // values that have not been set by the child.
+ assembleBuildInheritance( childBuild, parentBuild );
+ }
+ }
- if ( childBuild.getSourceDirectory() == null )
- {
- childBuild.setSourceDirectory( parentBuild.getSourceDirectory() );
- }
+ public void assembleBuildInheritance( Build childBuild,
+ Build parentBuild )
+ {
+ // The build has been set but we want to step in here and fill in
+ // values that have not been set by the child.
- if ( childBuild.getScriptSourceDirectory() == null )
- {
- childBuild.setScriptSourceDirectory( parentBuild.getScriptSourceDirectory() );
- }
+ if ( childBuild.getSourceDirectory() == null )
+ {
+ childBuild.setSourceDirectory( parentBuild.getSourceDirectory() );
+ }
- if ( childBuild.getTestSourceDirectory() == null )
- {
- childBuild.setTestSourceDirectory( parentBuild.getTestSourceDirectory() );
- }
+ if ( childBuild.getScriptSourceDirectory() == null )
+ {
+ childBuild.setScriptSourceDirectory( parentBuild.getScriptSourceDirectory() );
+ }
- if ( childBuild.getOutputDirectory() == null )
- {
- childBuild.setOutputDirectory( parentBuild.getOutputDirectory() );
- }
+ if ( childBuild.getTestSourceDirectory() == null )
+ {
+ childBuild.setTestSourceDirectory( parentBuild.getTestSourceDirectory() );
+ }
- if ( childBuild.getTestOutputDirectory() == null )
- {
- childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() );
- }
+ if ( childBuild.getOutputDirectory() == null )
+ {
+ childBuild.setOutputDirectory( parentBuild.getOutputDirectory() );
+ }
- // Extensions are accumlated
- ModelUtils.mergeExtensionLists( childBuild, parentBuild );
+ if ( childBuild.getTestOutputDirectory() == null )
+ {
+ childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() );
+ }
- if ( childBuild.getDirectory() == null )
- {
- childBuild.setDirectory( parentBuild.getDirectory() );
- }
+ // Extensions are accumlated
+ ModelUtils.mergeExtensionLists( childBuild, parentBuild );
- if ( childBuild.getDefaultGoal() == null )
- {
- childBuild.setDefaultGoal( parentBuild.getDefaultGoal() );
- }
+ if ( childBuild.getDirectory() == null )
+ {
+ childBuild.setDirectory( parentBuild.getDirectory() );
+ }
- if ( childBuild.getFinalName() == null )
- {
- childBuild.setFinalName( parentBuild.getFinalName() );
- }
+ if ( childBuild.getDefaultGoal() == null )
+ {
+ childBuild.setDefaultGoal( parentBuild.getDefaultGoal() );
+ }
- ModelUtils.mergeFilterLists( childBuild.getFilters(), parentBuild.getFilters() );
+ if ( childBuild.getFinalName() == null )
+ {
+ childBuild.setFinalName( parentBuild.getFinalName() );
+ }
- List resources = childBuild.getResources();
- if ( ( resources == null ) || resources.isEmpty() )
- {
- childBuild.setResources( parentBuild.getResources() );
- }
+ ModelUtils.mergeFilterLists( childBuild.getFilters(), parentBuild.getFilters() );
- resources = childBuild.getTestResources();
- if ( ( resources == null ) || resources.isEmpty() )
- {
- childBuild.setTestResources( parentBuild.getTestResources() );
- }
+ List resources = childBuild.getResources();
+ if ( ( resources == null ) || resources.isEmpty() )
+ {
+ childBuild.setResources( parentBuild.getResources() );
+ }
- // Plugins are aggregated if Plugin.inherit != false
- ModelUtils.mergePluginLists( childBuild, parentBuild, true );
+ resources = childBuild.getTestResources();
+ if ( ( resources == null ) || resources.isEmpty() )
+ {
+ childBuild.setTestResources( parentBuild.getTestResources() );
+ }
- // Plugin management :: aggregate
- PluginManagement dominantPM = childBuild.getPluginManagement();
- PluginManagement recessivePM = parentBuild.getPluginManagement();
+ // Plugins are aggregated if Plugin.inherit != false
+ ModelUtils.mergePluginLists( childBuild, parentBuild, true );
- if ( ( dominantPM == null ) && ( recessivePM != null ) )
- {
- // FIXME: Filter out the inherited == false stuff!
- childBuild.setPluginManagement( recessivePM );
- }
- else
- {
- ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(),
- false );
- }
+ // Plugin management :: aggregate
+ PluginManagement dominantPM = childBuild.getPluginManagement();
+ PluginManagement recessivePM = parentBuild.getPluginManagement();
+
+ if ( ( dominantPM == null ) && ( recessivePM != null ) )
+ {
+ // FIXME: Filter out the inherited == false stuff!
+ childBuild.setPluginManagement( recessivePM );
+ }
+ else
+ {
+ ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(),
+ false );
}
}
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java Tue Jun 24 11:46:35 2008
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
/**
@@ -33,5 +34,8 @@
void assembleModelInheritance( Model child, Model parent );
+ public void assembleBuildInheritance( Build childBuild,
+ Build parentBuild );
+
void copyModel( Model dest, Model source );
}
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java Tue Jun 24 11:46:35 2008
@@ -31,7 +31,13 @@
public class DefaultPathTranslator
implements PathTranslator
{
- private String FILE_SEPARATOR = "/";
+ private static final String FILE_SEPARATOR = "/";
+
+ private static final String[] BASEDIR_NAMES = {
+ "${basedir}",
+ "${pom.basedir}",
+ "${project.basedir}"
+ };
public void alignToBaseDirectory( Model model, File basedir )
{
@@ -91,13 +97,25 @@
private String stripBasedirToken( String s )
{
- String basedirExpr = "${basedir}";
-
if ( s != null )
{
s = s.trim();
- if ( s.startsWith( basedirExpr ) )
+ String basedirExpr = null;
+ for ( int i = 0; i < BASEDIR_NAMES.length; i++ )
+ {
+ basedirExpr = BASEDIR_NAMES[i];
+ if ( s.startsWith( basedirExpr ) )
+ {
+ break;
+ }
+ else
+ {
+ basedirExpr = null;
+ }
+ }
+
+ if ( basedirExpr != null )
{
if ( s.length() > basedirExpr.length() )
{
Modified: maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java Tue Jun 24 11:46:35 2008
@@ -180,6 +180,7 @@
File pom = getTestFile( "src/test/resources/projects/build-path-expression-pom.xml" );
MavenProject project = getProject( pom );
+ projectBuilder.calculateConcreteState( project, new DefaultProjectBuilderConfiguration() );
Build build = project.getBuild();
assertNotNull( "Project should have a build section containing the test resource.", build );
Modified: maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java?rev=671291&r1=671290&r2=671291&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java Tue Jun 24 11:46:35 2008
@@ -35,6 +35,7 @@
File f = getTestFile( dir + "project-which-needs-directory-alignment.xml" );
MavenProject project = getProject( f );
+ projectBuilder.calculateConcreteState( project, new DefaultProjectBuilderConfiguration() );
assertNotNull( "Test project can't be null!", project );