[MNG-7020] Remove Maven 2 WagonExcluder backward compat code

* Disable unused tests
* Update Maven 2 plugins to Maven 3 to avoid conflicts with old Maven
  and Wagon 1

This closes #78
This commit is contained in:
Michael Osipov 2020-11-13 23:29:19 +01:00
parent be210ff030
commit 3e892f99ed
11 changed files with 45 additions and 73 deletions

View File

@ -234,7 +234,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.0</version>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -48,7 +48,7 @@ public class MavenITmng3652UserAgentHeaderTest
public MavenITmng3652UserAgentHeaderTest()
{
super( "[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,)" ); // 2.1.0-M1+
super( "[3.0-beta-3,)" );
}
@Override
@ -139,21 +139,13 @@ public class MavenITmng3652UserAgentHeaderTest
// NOTE: system property for maven.version may not exist if you use -Dtest
// surefire parameter to run this single test. Therefore, the plugin writes
// the maven version into the check file.
String mavenVersion = getMavenUAVersion( lines.get( 0 ) );
String mavenVersion = lines.get( 0 );
String javaVersion = lines.get( 1 );
String os = lines.get( 2 ) + " " + lines.get( 3 );
String artifactVersion = lines.get( 4 );
if ( matchesVersionRange( "(,3.0-beta-3)" ) )
{
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")" + " maven-artifact/" + artifactVersion, userAgent );
}
else
{
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")", userAgent );
}
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")", userAgent );
}
public void testmng3652_UnConfiguredDAV()
@ -188,7 +180,7 @@ public class MavenITmng3652UserAgentHeaderTest
// NOTE: system property for maven.version may not exist if you use -Dtest
// surefire parameter to run this single test. Therefore, the plugin writes
// the maven version into the check file.
String mavenVersion = getMavenUAVersion( lines.get( 0 ) );
String mavenVersion = lines.get( 0 );
String javaVersion = lines.get( 1 );
String os = lines.get( 2 ) + " " + lines.get( 3 );
String artifactVersion = lines.get( 4 );
@ -196,16 +188,8 @@ public class MavenITmng3652UserAgentHeaderTest
String userAgent = this.userAgent;
assertNotNull( userAgent );
if ( matchesVersionRange( "(,3.0-beta-3)" ) )
{
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")" + " maven-artifact/" + artifactVersion, userAgent );
}
else
{
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")", userAgent );
}
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")", userAgent );
}
public void testmng3652_ConfigurationInSettingsWithoutUserAgent()
@ -242,7 +226,7 @@ public class MavenITmng3652UserAgentHeaderTest
// NOTE: system property for maven.version may not exist if you use -Dtest
// surefire parameter to run this single test. Therefore, the plugin writes
// the maven version into the check file.
String mavenVersion = getMavenUAVersion( lines.get( 0 ) );
String mavenVersion = lines.get( 0 );
String javaVersion = lines.get( 1 );
String os = lines.get( 2 ) + " " + lines.get( 3 );
String artifactVersion = lines.get( 4 );
@ -250,25 +234,13 @@ public class MavenITmng3652UserAgentHeaderTest
String userAgent = this.userAgent;
assertNotNull( userAgent );
if ( matchesVersionRange( "(,3.0-beta-3)" ) )
{
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")" + " maven-artifact/" + artifactVersion, userAgent );
}
else
{
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")", userAgent );
}
assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+ javaVersion + "; " + os + ")", userAgent );
}
public void testmng3652_UserAgentConfiguredInSettings()
throws Exception
{
// customizing version not supported in Maven 3
//requiresMavenVersion( "(,3.0-beta-3)" );
requiresMavenVersion("[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,)");
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" );
File pluginDir = new File( testDir, "test-plugin" );
File projectDir = new File( testDir, "test-project" );
@ -302,9 +274,6 @@ public class MavenITmng3652UserAgentHeaderTest
public void testmng3652_AdditionalHttpHeaderConfiguredInSettings()
throws Exception
{
// customizing version not supported in Maven 3
requiresMavenVersion("[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,)");
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" );
File pluginDir = new File( testDir, "test-plugin" );
File projectDir = new File( testDir, "test-project" );
@ -335,16 +304,4 @@ public class MavenITmng3652UserAgentHeaderTest
assertEquals( "My wonderful header", customHeader );
}
private String getMavenUAVersion( String mavenVersion )
{
if ( matchesVersionRange( "(,3.0-beta-3)" ) )
{
return mavenVersion.substring( 0, 3 );
}
else
{
// Maven 3 returns the whole version
return mavenVersion;
}
}
}

View File

@ -37,7 +37,7 @@ public class MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest
public MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest()
{
super( "[2.0.5,3.0-alpha-1),[3.0-alpha-7,)" );
super( "[2.0.5,3.0-alpha-1),[3.0-alpha-7,4.0.0-alpha-1)" );
}
/**

View File

@ -74,10 +74,10 @@ public class MavenITmng5669ReadPomsOnce
break;
}
}
assertEquals( logTxt.toString(), 168, logTxt.size() );
assertEquals( logTxt.toString(), 202, logTxt.size() );
// analyze lines. It is a Hashmap, so we can't rely on the order
Set<String> uniqueBuildingSources = new HashSet<>( 168 );
Set<String> uniqueBuildingSources = new HashSet<>( 202 );
final String buildSourceKey = "org.apache.maven.model.building.source=";
final int keyLength = buildSourceKey.length();
for ( String line : logTxt )
@ -95,7 +95,7 @@ public class MavenITmng5669ReadPomsOnce
}
uniqueBuildingSources.add( line.substring( start + keyLength, end ) );
}
assertEquals( uniqueBuildingSources.size(), 167 /* is 168 minus superpom */ );
assertEquals( uniqueBuildingSources.size(), 201 /* is 202 minus superpom */ );
}
public void testWithBuildConsumer()
@ -128,11 +128,11 @@ public class MavenITmng5669ReadPomsOnce
break;
}
}
assertEquals( logTxt.toString(), 168 + 4 /* reactor poms are read twice: file + raw (=XMLFilters) */,
assertEquals( logTxt.toString(), 202 + 4 /* reactor poms are read twice: file + raw (=XMLFilters) */,
logTxt.size() );
// analyze lines. It is a Hashmap, so we can't rely on the order
Set<String> uniqueBuildingSources = new HashSet<>( 168 );
Set<String> uniqueBuildingSources = new HashSet<>( 202 );
final String buildSourceKey = "org.apache.maven.model.building.source=";
final int keyLength = buildSourceKey.length();
for ( String line : logTxt )
@ -150,7 +150,7 @@ public class MavenITmng5669ReadPomsOnce
}
uniqueBuildingSources.add( line.substring( start + keyLength, end ) );
}
assertEquals( uniqueBuildingSources.size(), 167 /* is 168 minus superpom */ );
assertEquals( uniqueBuildingSources.size(), 201 /* is 202 minus superpom */ );
}
}

View File

@ -70,6 +70,7 @@ org.apache.maven.plugins:maven-compiler-plugin:${stubPluginVersion}
org.apache.maven.plugins:maven-compiler-plugin:2.0.2
org.apache.maven.plugins:maven-compiler-plugin:3.1
org.apache.maven.plugins:maven-compiler-plugin:3.8.1
org.apache.maven.plugins:maven-compiler-plugin:3.10.1
org.apache.maven.plugins:maven-dependency-plugin:2.7
org.apache.maven.plugins:maven-dependency-plugin:2.8
org.apache.maven.plugins:maven-deploy-plugin:${stubPluginVersion}

View File

@ -15,9 +15,18 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.10</version>
<version>3.0.0</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -15,7 +15,7 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.0</version>
<version>3.0.0</version>
</extension>
</extensions>
</build>

View File

@ -10,13 +10,13 @@
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
<version>2.0.9</version>
<artifactId>maven-compat</artifactId>
<version>3.0-beta-3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
<version>3.0-beta-3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@ -27,7 +27,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0.9</version>
<version>3.0-beta-3</version>
</dependency>
</dependencies>
</project>

View File

@ -25,7 +25,7 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.0</version>
<version>3.0.0</version>
</extension>
</extensions>
</build>

View File

@ -39,25 +39,25 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<version>3.2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
</project>

View File

@ -34,6 +34,11 @@ under the License.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>resolver-demo-maven-plugin</artifactId>