mirror of
https://github.com/apache/maven.git
synced 2025-02-22 01:45:37 +00:00
[MNG-4745] [regression] Maven does not check for plugin updates, even if forced via -U
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@980966 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0a350d87da
commit
e39fe99fa1
@ -82,6 +82,7 @@ public static Test suite()
|
||||
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||
|
||||
suite.addTestSuite( MavenITmng4745PluginVersionUpdateTest.class );
|
||||
suite.addTestSuite( MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.class );
|
||||
suite.addTestSuite( MavenITmng4721OptionalPluginDependencyTest.class );
|
||||
suite.addTestSuite( MavenITmng4720DependencyManagementExclusionMergeTest.class );
|
||||
|
@ -41,7 +41,7 @@ public MavenITmng1908LegacySnapshotUpdateTest()
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that legacy repositories with legacy snapshots download correctly.
|
||||
* Test that legacy repositories with legacy snapshots (i.e. without metadata) download correctly.
|
||||
*/
|
||||
public void testitMNG1908()
|
||||
throws Exception
|
||||
|
@ -0,0 +1,163 @@
|
||||
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.FileUtils;
|
||||
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-4745">MNG-4745</a>.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
public class MavenITmng4745PluginVersionUpdateTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng4745PluginVersionUpdateTest()
|
||||
{
|
||||
super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the update policy of a (plugin) repository affects the check for newer plugin versions.
|
||||
*/
|
||||
public void testitRepoPolicyAlways()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4745" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteArtifacts( "org.apache.maven.its.mng4745" );
|
||||
verifier.getCliOptions().add( "-s" );
|
||||
verifier.getCliOptions().add( "settings.xml" );
|
||||
Properties filterProps = verifier.newDefaultFilterProperties();
|
||||
filterProps.setProperty( "@updates@", "always" );
|
||||
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
|
||||
|
||||
writeMetadata( testDir, "1.0", "20100729123455" );
|
||||
verifier.setLogFileName( "log-1a.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng4745:maven-it-plugin:touch" );
|
||||
|
||||
writeMetadata( testDir, "1.1", "20100730123456" );
|
||||
verifier.setLogFileName( "log-1b.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng4745:maven-it-plugin:touch" );
|
||||
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
Properties props = verifier.loadProperties( "target/plugin.properties" );
|
||||
assertEquals( "1.1", props.get( "plugin.version" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the update policy of a (plugin) repository affects the check for newer plugin versions.
|
||||
*/
|
||||
public void testitRepoPolicyNever()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4745" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteArtifacts( "org.apache.maven.its.mng4745" );
|
||||
verifier.getCliOptions().add( "-s" );
|
||||
verifier.getCliOptions().add( "settings.xml" );
|
||||
Properties filterProps = verifier.newDefaultFilterProperties();
|
||||
filterProps.setProperty( "@updates@", "never" );
|
||||
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
|
||||
|
||||
writeMetadata( testDir, "1.0", "20100729123455" );
|
||||
verifier.setLogFileName( "log-2a.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng4745:maven-it-plugin:touch" );
|
||||
|
||||
writeMetadata( testDir, "1.1", "20100730123456" );
|
||||
verifier.setLogFileName( "log-2b.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng4745:maven-it-plugin:touch" );
|
||||
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
Properties props = verifier.loadProperties( "target/plugin.properties" );
|
||||
assertEquals( "1.0", props.get( "plugin.version" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the CLI's force update flag affects the check for newer plugin versions.
|
||||
*/
|
||||
public void testitForceUpdate()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4745" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteArtifacts( "org.apache.maven.its.mng4745" );
|
||||
verifier.getCliOptions().add( "-U" );
|
||||
verifier.getCliOptions().add( "-s" );
|
||||
verifier.getCliOptions().add( "settings.xml" );
|
||||
Properties filterProps = verifier.newDefaultFilterProperties();
|
||||
filterProps.setProperty( "@updates@", "never" );
|
||||
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
|
||||
|
||||
writeMetadata( testDir, "1.0", "20100729123455" );
|
||||
verifier.setLogFileName( "log-3a.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng4745:maven-it-plugin:touch" );
|
||||
|
||||
writeMetadata( testDir, "1.1", "20100730123456" );
|
||||
verifier.setLogFileName( "log-3b.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng4745:maven-it-plugin:touch" );
|
||||
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
Properties props = verifier.loadProperties( "target/plugin.properties" );
|
||||
assertEquals( "1.1", props.get( "plugin.version" ) );
|
||||
}
|
||||
|
||||
private static void writeMetadata( File testdir, String version, String timestamp )
|
||||
throws Exception
|
||||
{
|
||||
StringBuffer content = new StringBuffer( 1024 );
|
||||
content.append( "<?xml version=\"1.0\"?>\n" );
|
||||
content.append( "<metadata>\n" );
|
||||
content.append( " <groupId>org.apache.maven.its.mng4745</groupId>\n" );
|
||||
content.append( " <artifactId>maven-it-plugin</artifactId>\n" );
|
||||
content.append( " <versioning>\n" );
|
||||
content.append( " <latest>" + version + "</latest>\n" );
|
||||
content.append( " <release>" + version + "</release>\n" );
|
||||
content.append( " <versions>\n" );
|
||||
content.append( " <version>1.0</version>\n" );
|
||||
content.append( " </versions>\n" );
|
||||
content.append( " <lastUpdated>" + timestamp + "</lastUpdated>\n" );
|
||||
content.append( " </versioning>\n" );
|
||||
content.append( "</metadata>\n" );
|
||||
|
||||
File metadata = new File( testdir, "repo/org/apache/maven/its/mng4745/maven-it-plugin/maven-metadata.xml" );
|
||||
metadata.getParentFile().mkdirs();
|
||||
FileUtils.fileWrite( metadata.getAbsolutePath(), "UTF-8", content.toString() );
|
||||
}
|
||||
|
||||
}
|
33
its/core-it-suite/src/test/resources/mng-4745/pom.xml
Normal file
33
its/core-it-suite/src/test/resources/mng-4745/pom.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?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.mng4745</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<name>Maven Integration Test :: MNG-4745</name>
|
||||
<description>
|
||||
Verify that checks for plugin updates can be controlled via repository update policy and command line (-U).
|
||||
</description>
|
||||
</project>
|
Binary file not shown.
@ -0,0 +1,69 @@
|
||||
<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its.mng4745</groupId>
|
||||
<artifactId>maven-it-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven Integration Test Plugin :: Touch</name>
|
||||
<description>
|
||||
A test plugin that creates a properties file indicating the plugin version.
|
||||
</description>
|
||||
<inceptionYear>2009</inceptionYear>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>.</directory>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/**</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
Binary file not shown.
@ -0,0 +1,68 @@
|
||||
<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its.mng4745</groupId>
|
||||
<artifactId>maven-it-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven Integration Test Plugin :: Touch</name>
|
||||
<description>
|
||||
A test plugin that creates a properties file indicating the plugin version.
|
||||
</description>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>.</directory>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/**</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
@ -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.
|
||||
-->
|
||||
|
||||
<settings>
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<!-- make sure central isn't touched -->
|
||||
<id>test-mirror</id>
|
||||
<url>@baseurl@/repo-null</url>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
</mirror>
|
||||
</mirrors>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>maven-core-it-repo</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>@baseurl@/repo</url>
|
||||
<releases>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
<updatePolicy>@updates@</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven-core-it</id>
|
||||
<url>@baseurl@/repo</url>
|
||||
<releases>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
<updatePolicy>@updates@</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
<activeProfiles>
|
||||
<activeProfile>maven-core-it-repo</activeProfile>
|
||||
</activeProfiles>
|
||||
</settings>
|
Loading…
x
Reference in New Issue
Block a user