You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/09/02 21:46:10 UTC
svn commit: r992078 - in /maven/core-integration-testing/trunk:
core-it-suite/src/test/java/org/apache/maven/it/
core-it-suite/src/test/resources/mng-4791/
core-it-suite/src/test/resources/mng-4791/repo/
core-it-suite/src/test/resources/mng-4791/repo/o...
Author: bentmann
Date: Thu Sep 2 19:46:09 2010
New Revision: 992078
URL: http://svn.apache.org/viewvc?rev=992078&view=rev
Log:
[MNG-4791] [regression] POM artifacts passed into MavenProjectBuilder.buildFromRepository() are no longer resolved
o Added IT
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/a-0.1-20100902.190819-1.pom
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/maven-metadata.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/settings-template.xml (with props)
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java
Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=992078&r1=992077&r2=992078&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Thu Sep 2 19:46:09 2010
@@ -81,6 +81,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.class );
suite.addTestSuite( MavenITmng4786AntBased21xMojoSupportTest.class );
suite.addTestSuite( MavenITmng4781DeploymentToNexusStagingRepoTest.class );
suite.addTestSuite( MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.class );
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java?rev=992078&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java Thu Sep 2 19:46:09 2010
@@ -0,0 +1,70 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4791">MNG-4791</a>.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest()
+ {
+ super( "[2.0.3,3.0-alpha-1),[3.0-beta-1,)" );
+ }
+
+ /**
+ * Test that the project builder resolves the input artifact when building remote POMs if the input artifact
+ * happens to be of type "pom".
+ */
+ public void testit()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4791" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng4791" );
+ verifier.getCliOptions().add( "-s" );
+ verifier.getCliOptions().add( "settings.xml" );
+ verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "target/pom.properties" );
+
+ assertEquals( "0.1-20100902.190819-1",
+ props.getProperty( "org.apache.maven.its.mng4791:a:pom:0.1-SNAPSHOT.version" ) );
+ String path = props.getProperty( "org.apache.maven.its.mng4791:a:pom:0.1-SNAPSHOT.file" );
+ assertTrue( path, path.endsWith( ".pom" ) );
+ }
+
+}
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/pom.xml?rev=992078&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/pom.xml Thu Sep 2 19:46:09 2010
@@ -0,0 +1,65 @@
+<?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.mng4791</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4791</name>
+ <description>
+ Test that the project builder resolves the input artifact when building remote POMs if the input artifact
+ happens to be of type "pom".
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-project</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>remote-pom</goal>
+ </goals>
+ <configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng4791</groupId>
+ <artifactId>a</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <!-- key point here is using type=pom -->
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/a-0.1-20100902.190819-1.pom
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/a-0.1-20100902.190819-1.pom?rev=992078&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/a-0.1-20100902.190819-1.pom (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/a-0.1-20100902.190819-1.pom Thu Sep 2 19:46:09 2010
@@ -0,0 +1,39 @@
+<?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.mng4791</groupId>
+ <artifactId>a</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>MNG-4791</name>
+ <description>PASSED</description>
+
+ <distributionManagement>
+ <repository>
+ <id>maven-core-it</id>
+ <url>file:///${basedir}/repo</url>
+ </repository>
+ </distributionManagement>
+</project>
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/maven-metadata.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/maven-metadata.xml?rev=992078&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/maven-metadata.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/maven-metadata.xml Thu Sep 2 19:46:09 2010
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+ <groupId>org.apache.maven.its.mng4791</groupId>
+ <artifactId>a</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20100902.190819</timestamp>
+ <buildNumber>1</buildNumber>
+ </snapshot>
+ <lastUpdated>20100902190819</lastUpdated>
+ </versioning>
+</metadata>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/maven-metadata.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/repo/org/apache/maven/its/mng4791/a/0.1-SNAPSHOT/maven-metadata.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/settings-template.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/settings-template.xml?rev=992078&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/settings-template.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/settings-template.xml Thu Sep 2 19:46:09 2010
@@ -0,0 +1,55 @@
+<?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>maven-core-it-repo</id>
+ <repositories>
+ <repository>
+ <id>maven-core-it-repo</id>
+ <url>@baseurl@/repo</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <checksumPolicy>ignore</checksumPolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>maven-core-it-repo</id>
+ <url>@baseurl@/repo</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <checksumPolicy>ignore</checksumPolicy>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+ <activeProfiles>
+ <activeProfile>maven-core-it-repo</activeProfile>
+ </activeProfiles>
+</settings>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/settings-template.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4791/settings-template.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java?rev=992078&r1=992077&r2=992078&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java Thu Sep 2 19:46:09 2010
@@ -45,18 +45,20 @@ public abstract class AbstractPomMojo
protected void dump( Properties props, String key, MavenProject project )
{
- props.setProperty( key + "project.id", project.getId() );
- if ( project.getName() != null )
- {
- props.setProperty( key + "project.name", project.getName() );
- }
- if ( project.getDescription() != null )
+ put( props, key + "project.id", project.getId() );
+ put( props, key + "project.name", project.getName() );
+ put( props, key + "project.description", project.getDescription() );
+ if ( project.getArtifact() != null )
{
- props.setProperty( key + "project.description", project.getDescription() );
+ put( props, key + "artifact.id", project.getArtifact().getId() );
}
- if ( project.getArtifact() != null )
+ }
+
+ protected void put( Properties props, String key, Object value )
+ {
+ if ( value != null )
{
- props.setProperty( key + "artifact.id", project.getArtifact().getId() );
+ props.setProperty( key, value.toString() );
}
}
Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java?rev=992078&r1=992077&r2=992078&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java Thu Sep 2 19:46:09 2010
@@ -104,18 +104,23 @@ public class BuildRemotePomMojo
dependency.getVersion(), dependency.getType(),
dependency.getClassifier() );
- getLog().info( "[MAVEN-CORE-IT-LOG] Building " + artifact.getId() );
+ String id = artifact.getId();
+
+ getLog().info( "[MAVEN-CORE-IT-LOG] Building " + id );
try
{
MavenProject project = builder.buildFromRepository( artifact, remoteRepositories, localRepository );
- dump( props, artifact.getId() + ".", project );
+ dump( props, id + ".", project );
}
catch ( Exception e )
{
getLog().warn( "Failed to build remote POM for " + artifact.getId(), e );
}
+
+ put( props, id + ".file", artifact.getFile() );
+ put( props, id + ".version", artifact.getVersion() );
}
}