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 2009/03/31 23:07:57 UTC
svn commit: r760635 - in /maven/components/trunk:
maven-core/src/main/java/org/apache/maven/plugin/
maven-core/src/test/java/org/apache/maven/settings/
maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/
maven-project-builder/sr...
Author: sisbell
Date: Tue Mar 31 21:07:56 2009
New Revision: 760635
URL: http://svn.apache.org/viewvc?rev=760635&view=rev
Log:
Fixed settings profile activation for maven plugins. Cleaned up project builder. Unit Tests.
Added:
maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/
maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/pom.xml
maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/settings.xml
maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/
maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/pom.xml
maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/sub/
maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/sub/pom.xml
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ProfilePropertiesProcessor.java
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=760635&r1=760634&r2=760635&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Tue Mar 31 21:07:56 2009
@@ -379,7 +379,6 @@
try
{
Artifact pluginPomArtifact = repositorySystem.createProjectArtifact( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion() );
-
// This does not populate the artifacts of the dependenct projects
MavenProject pluginProject = mavenProjectBuilder.buildFromRepository( pluginPomArtifact, project.getRemoteArtifactRepositories(), localRepository );
@@ -1847,7 +1846,6 @@
try
{
artifact = repositorySystem.createProjectArtifact( groupId, artifactId, artifactVersion );
-
pluginProject = mavenProjectBuilder.buildFromRepository( artifact, project.getRemoteArtifactRepositories(), localRepository );
}
catch ( ProjectBuildingException e )
@@ -1875,10 +1873,10 @@
throws PluginManagerException, InvalidPluginException, PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException
{
logger.debug( "Resolving plugin artifact " + plugin.getKey() + " from " + project.getRemoteArtifactRepositories() );
-
+
ArtifactRepository localRepository = session.getLocalRepository();
- MavenProject pluginProject = buildPluginProject( plugin, localRepository, project.getRemoteArtifactRepositories() );
+ MavenProject pluginProject = buildPluginProject( plugin, localRepository, session );
Artifact pluginArtifact = repositorySystem.createPluginArtifact( plugin );
@@ -1897,13 +1895,13 @@
return pluginArtifact;
}
- public MavenProject buildPluginProject( Plugin plugin, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
+ public MavenProject buildPluginProject( Plugin plugin, ArtifactRepository localRepository, MavenSession session )
throws InvalidPluginException
{
Artifact artifact = repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion() );
try
{
- MavenProject p = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository );
+ MavenProject p = mavenProjectBuilder.buildFromRepository(artifact, session.getProjectBuilderConfiguration());
return p;
}
Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java?rev=760635&r1=760634&r2=760635&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java Tue Mar 31 21:07:56 2009
@@ -45,7 +45,19 @@
PomTestWrapper pom = buildPom( "settings-no-pom" );
assertEquals( "local-profile-prop-value", pom.getValue( "properties/local-profile-prop" ) );
}
-
+
+ /**MNG-4107 */
+ /*
+ public void testPomAndSettingsInterpolation() throws Exception
+ {
+ PomTestWrapper pom = buildPom( "test-pom-and-settings-interpolation" );
+ System.out.println(pom.getDomainModel().asString());
+ assertEquals("applied", pom.getValue( "properties/settingsProfile" ) );
+ assertEquals("applied", pom.getValue( "properties/pomProfile" ) );
+ assertEquals("settings", pom.getValue( "properties/pomVsSettings" ) );
+ assertEquals("settings", pom.getValue( "properties/pomVsSettingsInterpolated" ) );
+ }
+*/
private PomTestWrapper buildPom( String pomPath )
throws Exception
{
Added: maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/pom.xml?rev=760635&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/pom.xml (added)
+++ maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/pom.xml Tue Mar 31 21:07:56 2009
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng4107</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4107</name>
+ <description>
+ Test that POM interpolation uses the property values from the dominant profile source (POM vs. profiles.xml
+ vs. settings.xml). This boils down to the proper order of profile injection and interpolation, i.e.
+ interpolate after profiles from all sources are injected.
+ </description>
+
+ <properties>
+ <!-- collect the effective property values as derived by interpolation -->
+ <pomVsSettingsInterpolated>${pomVsSettings}</pomVsSettingsInterpolated>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>pom</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <pomProfile>applied</pomProfile>
+ <pomVsSettings>pom</pomVsSettings>
+ </properties>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-expression</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>eval</goal>
+ </goals>
+ <configuration>
+ <outputFile>target/pom.properties</outputFile>
+ <expressions>
+ <expression>project/properties</expression>
+ </expressions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/settings.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/settings.xml?rev=760635&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/settings.xml (added)
+++ maven/components/trunk/maven-core/src/test/resources-settings/test-pom-and-settings-interpolation/settings.xml Tue Mar 31 21:07:56 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<settings>
+ <profiles>
+ <profile>
+ <id>settings</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <settingsProfile>applied</settingsProfile>
+ <pomVsSettings>settings</pomVsSettings>
+ </properties>
+ </profile>
+ </profiles>
+</settings>
Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ProfilePropertiesProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ProfilePropertiesProcessor.java?rev=760635&r1=760634&r2=760635&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ProfilePropertiesProcessor.java (original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ProfilePropertiesProcessor.java Tue Mar 31 21:07:56 2009
@@ -13,7 +13,7 @@
Model t = (Model) target, c = (Model) child, p = (Model) parent;
Properties properties = new Properties();
-
+
if ( c.getProperties() != null )
{
properties.putAll( c.getProperties() );
@@ -32,9 +32,21 @@
}
else
{
+ //add(properties, t.getProperties());
t.getProperties().putAll( properties );
}
}
}
+
+ private static void add(Properties source, Properties target)
+ {
+ for(Object key : source.keySet())
+ {
+ if(!target.containsKey(key))
+ {
+ target.put(key, source.get(key));
+ }
+ }
+ }
}
Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=760635&r1=760634&r2=760635&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Tue Mar 31 21:07:56 2009
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -128,7 +129,12 @@
public MavenProject build( File pomFile, ProjectBuilderConfiguration configuration )
throws ProjectBuildingException
{
- MavenProject project = readModelFromLocalPath( "unknown", pomFile, configuration.getLocalRepository(), configuration.getRemoteRepositories(), configuration );
+ MavenProject project;
+ try {
+ project = buildWithoutProfiles( "unknown", pomFile, configuration.getLocalRepository(), configuration.getRemoteRepositories(), configuration );
+ } catch (IOException e) {
+ throw new ProjectBuildingException("", "", e);
+ }
project.setFile( pomFile );
project = buildWithProfiles( project.getModel(), configuration, pomFile, project.getParentFile() );
@@ -161,10 +167,11 @@
return buildFromRepository( pomArtifact, remoteArtifactRepositories, localRepository );
}
-
- public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
- throws ProjectBuildingException
+
+ public MavenProject buildFromRepository(Artifact artifact, ProjectBuilderConfiguration configuration )
+ throws ProjectBuildingException
{
+
MavenProject project = hm.get( artifact.getId() );
if ( project != null )
@@ -172,7 +179,7 @@
return project;
}
- ArtifactResolutionRequest request = new ArtifactResolutionRequest( artifact, localRepository, remoteRepositories );
+ ArtifactResolutionRequest request = new ArtifactResolutionRequest( artifact, configuration.getLocalRepository(), configuration.getRemoteRepositories() );
ArtifactResolutionResult result = repositorySystem.resolve( request );
try
@@ -183,19 +190,30 @@
{
throw new ProjectBuildingException( artifact.getId(), "Error resolving project artifact.", e );
}
- //Won't know anything about settings profiles in this path
- ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration()
- .setLocalRepository( localRepository )
- .setRemoteRepositories( remoteRepositories );
- project = readModelFromLocalPath( "unknown", artifact.getFile(), config.getLocalRepository(), remoteRepositories, config );
- project = buildWithProfiles( project.getModel(), config, artifact.getFile(), project.getParentFile() );
+ try {
+ project = buildWithoutProfiles( "unknown", artifact.getFile(), configuration.getLocalRepository(),
+ configuration.getRemoteRepositories(), configuration );
+ } catch (IOException e) {
+ throw new ProjectBuildingException(artifact.getId(), "Error reading project artifact.", e);
+ }
+ project = buildWithProfiles( project.getModel(), configuration, artifact.getFile(), project.getParentFile() );
+
artifact.setFile( artifact.getFile() );
project.setVersion( artifact.getVersion() );
hm.put( artifact.getId(), project );
- return project;
+ return project;
+ }
+
+ public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
+ throws ProjectBuildingException
+ {
+ ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration()
+ .setLocalRepository( localRepository )
+ .setRemoteRepositories(remoteRepositories);
+ return buildFromRepository(artifact, configuration);
}
/**
@@ -252,6 +270,7 @@
.setRemoteRepostories( project.getRemoteArtifactRepositories() )
.setManagedVersionMap( project.getManagedVersionMap() );
+
if(request.getRemoteRepostories() == null)
{
request.setRemoteRepostories( new ArrayList<ArtifactRepository>() );
@@ -285,9 +304,11 @@
if(externalProfileManager != null)
{
+ //System.out.println("PROFILES = " + externalProfileManager.getProfilesById().toString());
+
try
{
- projectProfiles.addAll( externalProfileManager.getActiveProfiles( model ) );
+ projectProfiles.addAll( externalProfileManager.getActiveProfiles( null ) );
}
catch ( ProfileActivationException e )
{
@@ -301,7 +322,7 @@
//System.out.println("PROFILE POM: COUNT = " + model.getProfiles().size());
try
{
- //System.out.println("PROFILE POM - ACTIVE: COUNT = " + profileManager.getActiveProfiles( model ).size());
+ //System.out.println("PROFILE POM - ACTIVE: COUNT = " + profileManager.getActiveProfiles( model ).size() +"," + projectProfiles.size());
projectProfiles.addAll( profileManager.getActiveProfiles( model ) );
}
catch ( ProfileActivationException e )
@@ -309,14 +330,21 @@
throw new ProjectBuildingException( projectId, "Failed to activate pom profiles.", projectDescriptor,
e );
}
+
+ List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
+ interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getExecutionProperties(), PomInterpolatorTag.EXECUTION_PROPERTIES.name() ) );
+ interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getUserProperties(), PomInterpolatorTag.USER_PROPERTIES.name() ) );
- if(!projectProfiles.isEmpty())
- {
+ if ( config.getBuildStartTime() != null )
+ {
+ interpolatorProperties.add( new InterpolatorProperty( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( config.getBuildStartTime() ),
+ PomInterpolatorTag.PROJECT_PROPERTIES.name() ) );
+ }
try
{
PomClassicDomainModel dm = ProcessorContext.mergeProfilesIntoModel( projectProfiles, model, false );
ProcessorContext.interpolateModelProperties( dm.getModelProperties(),
- new ArrayList<InterpolatorProperty>(), dm );
+ interpolatorProperties, dm );
dm = new PomClassicDomainModel( dm.getModelProperties(), false );
model = dm.getModel();
}
@@ -324,9 +352,11 @@
{
throw new ProjectBuildingException(projectId, "", projectDescriptor, e);
- }
- }
-
+ }
+
+ // }
+
+
MavenProject project;
try
@@ -351,34 +381,33 @@
return project;
}
- private MavenProject readModelFromLocalPath( String projectId, File pomFile, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, ProjectBuilderConfiguration config )
- throws ProjectBuildingException
- {
- List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
-
- interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getExecutionProperties(), PomInterpolatorTag.EXECUTION_PROPERTIES.name() ) );
+ private MavenProject buildWithoutProfiles( String projectId, File pomFile, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories, ProjectBuilderConfiguration projectBuilderConfiguration )
+ throws ProjectBuildingException, IOException
+ {
- interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getUserProperties(), PomInterpolatorTag.USER_PROPERTIES.name() ) );
+ List<String> activeProfileIds = ( projectBuilderConfiguration != null && projectBuilderConfiguration.getGlobalProfileManager() != null && projectBuilderConfiguration.getGlobalProfileManager()
+ .getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyActiveProfileIds() : new ArrayList<String>();
- if ( config.getBuildStartTime() != null )
- {
- interpolatorProperties.add( new InterpolatorProperty( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( config.getBuildStartTime() ),
- PomInterpolatorTag.PROJECT_PROPERTIES.name() ) );
- }
+ List<String> inactiveProfileIds = ( projectBuilderConfiguration != null && projectBuilderConfiguration.getGlobalProfileManager() != null && projectBuilderConfiguration
+ .getGlobalProfileManager().getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyInactiveProfileIds()
+ : new ArrayList<String>();
- MavenProject mavenProject;
+ PomClassicDomainModel domainModel = buildModel( pomFile, new ArrayList<InterpolatorProperty>(), activeProfileIds, inactiveProfileIds, localRepository, remoteRepositories );
try
{
- mavenProject = buildFromLocalPath( pomFile, interpolatorProperties, localRepository, remoteRepositories, config, this );
+ MavenProject mavenProject = new MavenProject( convertFromInputStreamToModel( domainModel.getInputStream() ), repositorySystem, this, projectBuilderConfiguration );
+
+ mavenProject.setParentFile( domainModel.getParentFile() );
+
+ return mavenProject;
}
- catch ( IOException e )
+ catch ( InvalidRepositoryException e )
{
- throw new ProjectBuildingException( projectId, "File = " + pomFile.getAbsolutePath(), e );
+ throw new IOException( e.getMessage() );
}
- return mavenProject;
-
}
private void validateModel( Model model, File pomFile )
@@ -520,7 +549,8 @@
else
{
profileModels.add( dm );
- }
+ }
+
}
PomClassicDomainModel transformedDomainModel = ProcessorContext.build( profileModels, properties );
@@ -556,34 +586,6 @@
return new PomClassicDomainModel( new ByteArrayInputStream( baos.toByteArray() ), isMostSpecialized );
}
- protected MavenProject buildFromLocalPath( File pom, Collection<InterpolatorProperty> interpolatorProperties, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
- ProjectBuilderConfiguration projectBuilderConfiguration, MavenProjectBuilder mavenProjectBuilder )
- throws IOException
- {
-
- List<String> activeProfileIds = ( projectBuilderConfiguration != null && projectBuilderConfiguration.getGlobalProfileManager() != null && projectBuilderConfiguration.getGlobalProfileManager()
- .getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyActiveProfileIds() : new ArrayList<String>();
-
- List<String> inactiveProfileIds = ( projectBuilderConfiguration != null && projectBuilderConfiguration.getGlobalProfileManager() != null && projectBuilderConfiguration
- .getGlobalProfileManager().getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyInactiveProfileIds()
- : new ArrayList<String>();
-
- PomClassicDomainModel domainModel = buildModel( pom, interpolatorProperties, activeProfileIds, inactiveProfileIds, localRepository, remoteRepositories );
-
- try
- {
- MavenProject mavenProject = new MavenProject( convertFromInputStreamToModel( domainModel.getInputStream() ), repositorySystem, mavenProjectBuilder, projectBuilderConfiguration );
-
- mavenProject.setParentFile( domainModel.getParentFile() );
-
- return mavenProject;
- }
- catch ( InvalidRepositoryException e )
- {
- throw new IOException( e.getMessage() );
- }
- }
-
private static Model convertFromInputStreamToModel( InputStream inputStream )
throws IOException
{
Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java?rev=760635&r1=760634&r2=760635&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java Tue Mar 31 21:07:56 2009
@@ -40,6 +40,9 @@
MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
throws ProjectBuildingException;
+
+ MavenProject buildFromRepository(Artifact artifact, ProjectBuilderConfiguration configuration )
+ throws ProjectBuildingException;
MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration configuration )
throws ProjectBuildingException;
Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=760635&r1=760634&r2=760635&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java Tue Mar 31 21:07:56 2009
@@ -25,6 +25,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
@@ -218,6 +219,7 @@
throws Exception
{
PomTestWrapper pom = buildPom( "plugin-management-dependencies/sub", "test" );
+ System.out.println(pom.getDomainModel().asString());
assertEquals( "1.0-alpha-21", pom.getValue( "build/plugins[1]/version" ) );
assertEquals( "1.0", pom.getValue( "build/plugins[1]/dependencies[1]/version" ) );
}
@@ -1016,6 +1018,14 @@
assertEquals("true", pom.getValue( "reporting/plugins[1]/configuration/booleanParam"));
}
+ public void testPropertiesNoDuplication()
+ throws Exception
+ {
+ PomTestWrapper pom = buildPom( "properties-no-duplication/sub" );
+ assertEquals(1, ( (Properties) pom.getValue( "properties" ) ).size());
+ assertEquals("child", pom.getValue( "properties/pomProfile" ) );
+ }
+
public void testCompleteModelWithoutParent()
throws Exception
{
@@ -1237,7 +1247,7 @@
{
PomTestWrapper pom =
buildPom( "profile-injection-order", "pom-a", "pom-b", "pom-e", "pom-c", "pom-d" );
-
+ System.out.println(pom.getDomainModel().asString());
assertEquals( "e", pom.getValue( "properties[1]/pomProperty" ) );
}
Added: maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/pom.xml?rev=760635&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/pom.xml (added)
+++ maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/pom.xml Tue Mar 31 21:07:56 2009
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>test-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <properties>
+ <pomProfile>parent</pomProfile>
+ </properties>
+</project>
Added: maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/sub/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/sub/pom.xml?rev=760635&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/sub/pom.xml (added)
+++ maven/components/trunk/maven-project/src/test/resources-project-builder/properties-no-duplication/sub/pom.xml Tue Mar 31 21:07:56 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>test-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <properties>
+ <pomProfile>child</pomProfile>
+ </properties>
+</project>
+