Author: bentmann Date: Wed Jul 27 10:26:37 2011 New Revision: 1151417 URL: http://svn.apache.org/viewvc?rev=1151417&view=rev Log: [MNG-5064] mvn -nsu (--no-snapshot-updates) should not download snapshots (and break local builds)
o Fixed IT Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/ (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.jar (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.pom maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/settings-template.xml (with props) Removed: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/src/ 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-suite/src/test/resources/mng-5064/pom.xml maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml 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=1151417&r1=1151416&r2=1151417&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 Wed Jul 27 10:26:37 2011 @@ -83,6 +83,7 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng5064SuppressSnapshotUpdatesTest.class ); suite.addTestSuite( MavenITmng5013ConfigureParamBeanFromScalarValueTest.class ); suite.addTestSuite( MavenITmng5012CollectionVsArrayParamCoercionTest.class ); suite.addTestSuite( MavenITmng5011ConfigureCollectionArrayFromSystemPropTest.class ); Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java?rev=1151417&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java Wed Jul 27 10:26:37 2011 @@ -0,0 +1,131 @@ +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.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Properties; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.mortbay.jetty.Server; +import org.mortbay.jetty.handler.AbstractHandler; +import org.mortbay.jetty.handler.DefaultHandler; +import org.mortbay.jetty.handler.HandlerList; +import org.mortbay.jetty.handler.ResourceHandler; + +/** + * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5064">MNG-5064</a>. + * + * @author Benjamin Bentmann + */ +public class MavenITmng5064SuppressSnapshotUpdatesTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng5064SuppressSnapshotUpdatesTest() + { + super( "[3.0.4,)" ); + } + + /** + * Verify that snapshot updates can be completely suppressed via the CLI arg -nsu. The initial retrieval of a + * missing snapshot should not be suppressed though. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5064" ); + + String metadataUri = "org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml"; + + final List requestedUris = Collections.synchronizedList( new ArrayList() ); + + AbstractHandler logHandler = new AbstractHandler() + { + public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch ) + throws IOException, ServletException + { + if ( request.getRequestURI().startsWith( "/repo/" ) ) + { + requestedUris.add( request.getRequestURI().substring( 6 ) ); + } + } + }; + + ResourceHandler repoHandler = new ResourceHandler(); + repoHandler.setResourceBase( testDir.getAbsolutePath() ); + + HandlerList handlerList = new HandlerList(); + handlerList.addHandler( logHandler ); + handlerList.addHandler( repoHandler ); + handlerList.addHandler( new DefaultHandler() ); + + Server server = new Server( 0 ); + server.setHandler( handlerList ); + server.start(); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + try + { + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng5064" ); + Properties filterProps = verifier.newDefaultFilterProperties(); + filterProps.setProperty( "@port@", Integer.toString( server.getConnectors()[0].getLocalPort() ) ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + verifier.getCliOptions().add( "-nsu" ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( "settings.xml" ); + + verifier.setLogFileName( "log-1.txt" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + + List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + assertTrue( classpath.toString(), classpath.contains( "dep-0.1-SNAPSHOT.jar" ) ); + assertTrue( requestedUris.toString(), requestedUris.contains( metadataUri ) ); + + requestedUris.clear(); + + verifier.setLogFileName( "log-2.txt" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + + classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + assertTrue( classpath.toString(), classpath.contains( "dep-0.1-SNAPSHOT.jar" ) ); + assertFalse( requestedUris.toString(), requestedUris.contains( metadataUri ) ); + } + finally + { + verifier.resetStreams(); + server.stop(); + } + } + +} Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/pom.xml?rev=1151417&r1=1151416&r2=1151417&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/pom.xml (original) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/pom.xml Wed Jul 27 10:26:37 2011 @@ -1,4 +1,5 @@ <?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 @@ -17,90 +18,48 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> + <project> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.maven.its.mng5064</groupId> - <artifactId>test-snapshot-ovverride</artifactId> - <version>1-SNAPSHOT</version> - <packaging>pom</packaging> - <name>Maven Integration Test :: MNG-5604 - test of -nsu</name> - <description> - Integration test that -nsu works as defined. + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.mng5064</groupId> + <artifactId>test</artifactId> + <version>0.1</version> + + <name>Maven Integration Test :: MNG-5064</name> + <description> + Verify that snapshot updates can be completely suppressed via the CLI arg -nsu. The initial retrieval of a + missing snapshot should not be suppressed though. </description> - <properties> - <localRepo1>${project.build.directory}/localRepo1</localRepo1> - <localRepo2>${project.build.directory}/localRepo2</localRepo2> - <deployRepo>${project.build.directory}/deployRepo</deployRepo> - </properties> - <build> - <plugins> - <plugin> - <artifactId>maven-invoker-plugin</artifactId> - <version>1.5</version> - <configuration> - <projectsDirectory>src/it</projectsDirectory> - </configuration> - <executions> - <execution> - <id>createLocalSnapshot</id> - <goals> - <goal>run</goal> - </goals> - <phase>generate-test-sources</phase> - <configuration> - <invokerTest>test-snapshot</invokerTest> - <localRepositoryPath>${localRepo1}</localRepositoryPath> - <properties> - <whichVersion>local</whichVersion> - </properties> - <goals> - <goal>clean</goal> - <goal>install</goal> - </goals> - </configuration> - </execution> - <execution> - <id>createNewerDeployment</id> - <goals> - <goal>run</goal> - </goals> - <phase>generate-test-sources</phase> - <configuration> - <invokerTest>test-snapshot</invokerTest> - <localRepositoryPath>${localRepo2}</localRepositoryPath> - <properties> - <whichVersion>deployed</whichVersion> - <deployRepo>${deployRepo}</deployRepo> - <altDeploymentRepository>test.deploy.repo::default::file://${deployRepo}</altDeploymentRepository> - </properties> - <goals> - <goal>clean</goal> - <goal>deploy</goal> - </goals> - </configuration> - </execution> - <execution> - <id>test</id> - <goals> - <goal>run</goal> - </goals> - <phase>integration-test</phase> - <configuration> - <invokerTest>test-nsu</invokerTest> - <localRepositoryPath>${localRepo1}</localRepositoryPath> - <properties> - <whichVersion>deployed</whichVersion> - <deployRepoUrl>file://${deployRepo}</deployRepoUrl> - <mavenOpts>-nsu</mavenOpts> - </properties> - <goals> - <goal>clean</goal> - <goal>test</goal> - </goals> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng5064</groupId> + <artifactId>dep</artifactId> + <version>0.1-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <artifactId>maven-it-plugin-dependency-resolution</artifactId> + <version>2.1-SNAPSHOT</version> + <configuration> + <testClassPath>target/classpath.txt</testClassPath> + <significantPathLevels>1</significantPathLevels> + </configuration> + <executions> + <execution> + <id>test</id> + <phase>validate</phase> + <goals> + <goal>test</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/ ------------------------------------------------------------------------------ bugtraq:number = true Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.jar URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.jar?rev=1151417&view=auto ============================================================================== Binary file - no diff available. Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.pom URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.pom?rev=1151417&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.pom (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/dep-0.1-20110726.105319-1.pom Wed Jul 27 10:26:37 2011 @@ -0,0 +1,36 @@ +<?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.mng5064</groupId> + <artifactId>dep</artifactId> + <version>0.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <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-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml?rev=1151417&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml Wed Jul 27 10:26:37 2011 @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metadata> + <groupId>org.apache.maven.its.mng5064</groupId> + <artifactId>dep</artifactId> + <version>0.1-SNAPSHOT</version> + <versioning> + <snapshot> + <timestamp>20110726.105319</timestamp> + <buildNumber>1</buildNumber> + </snapshot> + <lastUpdated>20110726105319</lastUpdated> + </versioning> +</metadata> Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/repo/org/apache/maven/its/mng5064/dep/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-5064/settings-template.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/settings-template.xml?rev=1151417&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/settings-template.xml (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/settings-template.xml Wed Jul 27 10:26:37 2011 @@ -0,0 +1,45 @@ +<?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</id> + <url>http://localhost:@port@/repo</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <!-- This should get overridden via -nsu CLI argument --> + <updatePolicy>always</updatePolicy> + <checksumPolicy>ignore</checksumPolicy> + </snapshots> + </repository> + </repositories> + </profile> + </profiles> + <activeProfiles> + <activeProfile>maven-core-it-repo</activeProfile> + </activeProfiles> +</settings> Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/settings-template.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5064/settings-template.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml?rev=1151417&r1=1151416&r2=1151417&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml (original) +++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml Wed Jul 27 10:26:37 2011 @@ -78,6 +78,8 @@ <extension>jar</extension> <packaging>it-packaging</packaging> <classifier>it</classifier> + <language>java</language> + <addedToClasspath>true</addedToClasspath> </configuration> </component> </components>