mirror of https://github.com/apache/maven.git
[MNG-7629] Change reactor reader to copy packaged artifacts and reuse them across builds if needed (#234)
This commit is contained in:
parent
348170eef1
commit
49c12573d6
|
@ -57,6 +57,7 @@ public class MavenITmng2720SiblingClasspathArtifactsTest
|
|||
|
||||
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.deleteDirectory( "child2/target" );
|
||||
verifier.deleteDirectory( "child3/target" );
|
||||
verifier.addCliArgument( "initialize" );
|
||||
|
|
|
@ -56,6 +56,7 @@ public class MavenITmng3043BestEffortReactorResolutionTest
|
|||
|
||||
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.deleteDirectory( "consumer-a/target" );
|
||||
verifier.deleteDirectory( "consumer-b/target" );
|
||||
verifier.deleteDirectory( "consumer-c/target" );
|
||||
|
@ -113,6 +114,7 @@ public class MavenITmng3043BestEffortReactorResolutionTest
|
|||
|
||||
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.deleteDirectory( "consumer-a/target" );
|
||||
verifier.deleteDirectory( "consumer-b/target" );
|
||||
verifier.deleteDirectory( "consumer-c/target" );
|
||||
|
@ -122,37 +124,39 @@ public class MavenITmng3043BestEffortReactorResolutionTest
|
|||
verifier.execute();
|
||||
verifier.verifyErrorFreeLog();
|
||||
|
||||
String prefix = matchesVersionRange("[4.0.0-alpha-4,)") ? "dependency-0.1-SNAPSHOT-" : "";
|
||||
|
||||
List<String> classpath;
|
||||
|
||||
classpath = verifier.loadLines( "consumer-a/target/compile.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "tests.jar" } );
|
||||
assertNotContains( classpath, new String[] { "client.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
assertNotContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
classpath = verifier.loadLines( "consumer-a/target/runtime.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "tests.jar" } );
|
||||
assertNotContains( classpath, new String[] { "client.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
assertNotContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
classpath = verifier.loadLines( "consumer-a/target/test.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "tests.jar" } );
|
||||
assertNotContains( classpath, new String[] { "client.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
assertNotContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
|
||||
classpath = verifier.loadLines( "consumer-b/target/compile.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "client.jar" } );
|
||||
assertNotContains( classpath, new String[] { "tests.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
assertNotContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
classpath = verifier.loadLines( "consumer-b/target/runtime.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "client.jar" } );
|
||||
assertNotContains( classpath, new String[] { "tests.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
assertNotContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
classpath = verifier.loadLines( "consumer-b/target/test.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "client.jar" } );
|
||||
assertNotContains( classpath, new String[] { "tests.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
assertNotContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
|
||||
classpath = verifier.loadLines( "consumer-c/target/compile.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "client.jar" } );
|
||||
assertContains( classpath, new String[] { "tests.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
classpath = verifier.loadLines( "consumer-c/target/runtime.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "client.jar" } );
|
||||
assertContains( classpath, new String[] { "tests.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
classpath = verifier.loadLines( "consumer-c/target/test.txt", "UTF-8" );
|
||||
assertContains( classpath, new String[] { "client.jar" } );
|
||||
assertContains( classpath, new String[] { "tests.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "client.jar" } );
|
||||
assertContains( classpath, new String[] { prefix + "tests.jar" } );
|
||||
}
|
||||
|
||||
private void assertContains( List<String> collection, String[] items )
|
||||
|
|
|
@ -119,10 +119,7 @@ public class MavenITmng4660OutdatedPackagedArtifact extends AbstractMavenIntegra
|
|||
{
|
||||
verifier3.verifyTextInLog( "File '"
|
||||
+ Paths.get( "module-a", "target", "classes", "example.properties" )
|
||||
+ "' is more recent than the packaged artifact for 'module-a'; "
|
||||
+ "using '"
|
||||
+ Paths.get( "module-a", "target","classes" )
|
||||
+ "' instead"
|
||||
+ "' is more recent than the packaged artifact for 'module-a', please run a full `mvn package` build"
|
||||
);
|
||||
}
|
||||
catch ( VerificationException e )
|
||||
|
|
|
@ -57,6 +57,7 @@ public class MavenITmng4814ReResolutionOfDependenciesDuringReactorTest
|
|||
|
||||
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.deleteDirectory( "consumer/target" );
|
||||
verifier.deleteArtifacts( "org.apache.maven.its.mng4814" );
|
||||
verifier.addCliArgument( "-s" );
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
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.shared.verifier.Verifier;
|
||||
import org.apache.maven.shared.verifier.util.ResourceExtractor;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-7629">MNG-7629</a>.
|
||||
* It checks that building a subtree that consumes an attached artifact works
|
||||
*
|
||||
*/
|
||||
class MavenITmng7629SubtreeBuildTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng7629SubtreeBuildTest()
|
||||
{
|
||||
super( "[4.0.0-alpha-4,)" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that dependencies which are managed through imported dependency management work
|
||||
*
|
||||
* @throws Exception in case of failure
|
||||
*/
|
||||
@Test
|
||||
void testBuildSubtree()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7629" );
|
||||
|
||||
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( true );
|
||||
verifier.addCliArgument( "verify" );
|
||||
verifier.execute();
|
||||
verifier.verifyErrorFreeLog();
|
||||
|
||||
verifier = newVerifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( true );
|
||||
verifier.addCliArguments( "-f", "child-2", "verify" );
|
||||
verifier.execute();
|
||||
verifier.verifyErrorFreeLog();
|
||||
}
|
||||
|
||||
}
|
|
@ -105,6 +105,7 @@ public class TestSuiteOrdering implements ClassOrderer
|
|||
* the tests are to finishing. Newer tests are also more likely to fail, so this is
|
||||
* a fail fast technique as well.
|
||||
*/
|
||||
suite.addTestSuite( MavenITmng7629SubtreeBuildTest.class );
|
||||
suite.addTestSuite( MavenITmng7606DependencyImportScopeTest.class );
|
||||
suite.addTestSuite( MavenITmng6609ProfileActivationForPackagingTest.class );
|
||||
suite.addTestSuite( MavenITmng7566JavaPrerequisiteTest.class );
|
||||
|
|
|
@ -132,6 +132,7 @@ org.apache.maven:maven-script-ant:2.1.0
|
|||
org.apache.maven:maven-settings-builder:3.1.1
|
||||
org.apache.maven:maven-settings:3.1.1
|
||||
org.codehaus.gmavenplus:gmavenplus-plugin:1.11.0
|
||||
org.codehaus.mojo:build-helper-maven-plugin:3.2.0
|
||||
org.codehaus.mojo:flatten-maven-plugin:1.0.0
|
||||
org.codehaus.plexus:plexus-classworlds:2.5.1
|
||||
org.codehaus.plexus:plexus-component-annotations:1.5.5
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<?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>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.maven.its.mng7629</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>child-1</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-mdo</id>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>src/main/mdo/settings.mdo</file>
|
||||
<type>mdo</type>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.maven.its.mng7629;
|
||||
|
||||
class Test {
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,71 @@
|
|||
<?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>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.maven.its.mng7629</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>child-2</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.mng7629</groupId>
|
||||
<artifactId>child-1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-model</id>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.maven.its.mng7629</groupId>
|
||||
<artifactId>child-1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<type>mdo</type>
|
||||
<outputDirectory>target/mdo/</outputDirectory>
|
||||
<destFileName>settings.mdo</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -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 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.its.mng7629</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>child-1</module>
|
||||
<module>child-2</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue