mirror of https://github.com/apache/maven.git
[MNG-7470] mvn 3.9+ IT that uses wagon (default) and native transport (#158)
An IT for Maven 3.9+ that "exercise" both resolver transport: wagon and native (so we have 2 tests both forcing transport with `-Dmaven.resolver.transport` one wagon (which is default, but setting is there to be explicit) and once native. It builds a project that needs a plugin (to pull it will use set transport), and that plugin will use resolver as well to resolve set artifact. If any of these fails, maven project fails. Related fix: https://github.com/apache/maven/pull/732 (jn maven-3.9.x and master)
This commit is contained in:
parent
e7d7e924a3
commit
07f35e0aa9
|
@ -60,12 +60,23 @@ public class HttpServer
|
|||
// server.join();
|
||||
}
|
||||
|
||||
public boolean isFailed()
|
||||
{
|
||||
return server.isFailed();
|
||||
}
|
||||
|
||||
public void stop()
|
||||
throws Exception
|
||||
{
|
||||
server.stop();
|
||||
}
|
||||
|
||||
public void join()
|
||||
throws Exception
|
||||
{
|
||||
server.join();
|
||||
}
|
||||
|
||||
public int port()
|
||||
{
|
||||
return ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort();
|
||||
|
|
|
@ -106,6 +106,7 @@ public class IntegrationTestSuite
|
|||
// Tests that don't run stable and need to be fixed
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||
suite.addTestSuite( MavenITmng7470ResolverTransportTest.class );
|
||||
suite.addTestSuite( MavenITmng7464ReadOnlyMojoParametersWarningTest.class );
|
||||
suite.addTestSuite( MavenITmng7404IgnorePrefixlessExpressionsTest.class );
|
||||
suite.addTestSuite( MavenITmng5222MojoDeprecatedTest.class );
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package org.apache.maven.it;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-7470">MNG-7470</a>:
|
||||
* check that Maven two bundled transports works as expected.
|
||||
*/
|
||||
public class MavenITmng7470ResolverTransportTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
private File testDir;
|
||||
|
||||
private File projectDir;
|
||||
|
||||
private HttpServer server;
|
||||
|
||||
private int port;
|
||||
|
||||
public MavenITmng7470ResolverTransportTest()
|
||||
{
|
||||
super( "[3.9.0,)" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7470-resolver-transport" );
|
||||
projectDir = new File( testDir, "project" );
|
||||
|
||||
server = HttpServer.builder()
|
||||
.port( 0 )
|
||||
.source( new File( testDir, "repo" ) )
|
||||
.build();
|
||||
server.start();
|
||||
if ( server.isFailed() )
|
||||
{
|
||||
fail( "Couldn't bind the server socket to a free port!" );
|
||||
}
|
||||
port = server.port();
|
||||
System.out.println( "Bound server socket to the port " + port );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
if ( server != null )
|
||||
{
|
||||
server.stop();
|
||||
server.join();
|
||||
}
|
||||
}
|
||||
|
||||
private void performTest( final String transport, final String logSnippet ) throws Exception
|
||||
{
|
||||
Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
properties.put( "@port@", Integer.toString( port ) );
|
||||
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties );
|
||||
verifier.setLogFileName( transport + "-transport.log" );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.deleteArtifacts( "org.apache.maven.its.resolver-transport" );
|
||||
verifier.addCliOption( "-X" );
|
||||
verifier.addCliOption( "-s" );
|
||||
verifier.addCliOption( new File( projectDir, "settings.xml" ).getAbsolutePath() );
|
||||
verifier.addCliOption( "-Pmaven-core-it-repo" );
|
||||
verifier.addCliOption( "-Dmaven.resolver.transport=" + transport );
|
||||
// Maven will fail if project dependencies cannot be resolved.
|
||||
// As dependency exists ONLY in HTTP repo, it MUST be reached using selected transport and
|
||||
// successfully resolved from it.
|
||||
verifier.executeGoal( "verify" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
// verify maven console output contains "[DEBUG] Using transporter XXXTransporter"
|
||||
verifier.verifyTextInLog( logSnippet );
|
||||
verifier.resetStreams();
|
||||
}
|
||||
|
||||
public void testResolverTransportWagon()
|
||||
throws Exception
|
||||
{
|
||||
performTest( "wagon", "[DEBUG] Using transporter WagonTransporter" );
|
||||
}
|
||||
|
||||
public void testResolverTransportNative()
|
||||
throws Exception
|
||||
{
|
||||
performTest( "native", "[DEBUG] Using transporter HttpTransporter" );
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.maven.its.bootstrap</groupId>
|
||||
<artifactId>maven-it-boostrap</artifactId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.maven.its.bootstrap</groupId>
|
||||
<artifactId>group-15</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: Boostrap :: Group-15 :: Resolver 1.7.3</name>
|
||||
|
||||
<properties>
|
||||
<resolverVersion>1.7.3</resolverVersion>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-api</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-spi</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-util</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-impl</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-connector-basic</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -51,6 +51,7 @@ under the License.
|
|||
<module>group-12</module>
|
||||
<module>group-13</module>
|
||||
<module>group-14</module>
|
||||
<module>group-15</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<?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.resolver-transport</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: resolver-transport</name>
|
||||
<description>
|
||||
Verify that Maven transport works.
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>resolver-demo-maven-plugin</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>resolve</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>resolve-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactCoords>org.apache.maven.its.resolver-transport:dependency:1.0</artifactCoords>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,52 @@
|
|||
<?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@</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven-core-it</id>
|
||||
<url>http://localhost:@port@</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>
|
3
its/core-it-suite/src/test/resources/mng-7470-resolver-transport/repo/.gitattributes
vendored
Normal file
3
its/core-it-suite/src/test/resources/mng-7470-resolver-transport/repo/.gitattributes
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.pom text eol=lf
|
||||
maven-metadata.xml text eol=lf
|
||||
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
b530516717ab5b3052fd3cdca860fc28574bd718
|
|
@ -0,0 +1,34 @@
|
|||
<?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.resolver-transport</groupId>
|
||||
<artifactId>dependency</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: resolver-transport :: dependency</name>
|
||||
<description>
|
||||
Dependency pulled with transport.
|
||||
</description>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
b58c041fe630e9248109e305c5d2d0c5fea978a3
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
ed81d315b44e79187fe8ad71b7b2665ac9b95f08
|
|
@ -0,0 +1,102 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>resolver-demo-maven-plugin</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven Artifact Resolver Demo Maven Plugin 1.7.3</name>
|
||||
|
||||
<prerequisites>
|
||||
<maven>${mavenVersion}</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<mavenVersion>3.8.5</mavenVersion>
|
||||
<resolverVersion>1.7.3</resolverVersion>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.sisu</groupId>
|
||||
<artifactId>org.eclipse.sisu.plexus</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-api</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
These dependencies BELOW are NOT USED by plugin,
|
||||
but are here to mimic what other not quite nicely written plugins do:
|
||||
they pull all resolver that are transitive dependencies of some maven
|
||||
artifact they use
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-spi</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-util</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-impl</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-connector-basic</artifactId>
|
||||
<version>${resolverVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
2a2ae11ad8e4c90eb3d48f3621b5d20eafea3ae3
|
Loading…
Reference in New Issue