This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
The following commit(s) were added to refs/heads/master by this push: new d39b1967a [MNG-7629] Change reactor reader to copy packaged artifacts and reuse them across builds if needed (#234) d39b1967a is described below commit d39b1967ad36af08359cb9530d0b74314089a167 Author: Guillaume Nodet <gno...@apache.org> AuthorDate: Thu Jan 19 11:54:42 2023 +0100 [MNG-7629] Change reactor reader to copy packaged artifacts and reuse them across builds if needed (#234) --- ...avenITmng2720SiblingClasspathArtifactsTest.java | 1 + ...enITmng3043BestEffortReactorResolutionTest.java | 40 +- .../it/MavenITmng4660OutdatedPackagedArtifact.java | 5 +- ...eResolutionOfDependenciesDuringReactorTest.java | 1 + ...st.java => MavenITmng7629SubtreeBuildTest.java} | 44 +- .../org/apache/maven/it/TestSuiteOrdering.java | 1 + .../src/test/resources-filtered/bootstrap.txt | 1 + .../test/resources/mng-7629/.mvn/placeholder.txt | 0 .../src/test/resources/mng-7629/child-1/pom.xml | 63 ++ .../java/org/apache/maven/its/mng7629/Test.java | 23 + .../mng-7629/child-1/src/main/mdo/settings.mdo | 1083 ++++++++++++++++++++ .../src/test/resources/mng-7629/child-2/pom.xml | 71 ++ core-it-suite/src/test/resources/mng-7629/pom.xml | 34 + 13 files changed, 1318 insertions(+), 49 deletions(-) diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java index 3dca206f2..76c3d604d 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java @@ -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" ); diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java index 27b2a3641..1985b8605 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java @@ -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 ) diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java index cfc476738..aa9f5637e 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java @@ -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 ) diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java index c8d8e0707..8a92a4ec4 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java @@ -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" ); diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7629SubtreeBuildTest.java similarity index 51% copy from core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java copy to core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7629SubtreeBuildTest.java index c8d8e0707..48b0c69aa 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7629SubtreeBuildTest.java @@ -19,58 +19,48 @@ package org.apache.maven.it; * under the License. */ -import org.apache.maven.shared.verifier.util.ResourceExtractor; 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; -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.Test; /** - * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-4814">MNG-4814</a>. + * 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 * - * @author Benjamin Bentmann */ -public class MavenITmng4814ReResolutionOfDependenciesDuringReactorTest +class MavenITmng7629SubtreeBuildTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4814ReResolutionOfDependenciesDuringReactorTest() + public MavenITmng7629SubtreeBuildTest() { - super( "[3.0,)" ); + super( "[4.0.0-alpha-4,)" ); } /** - * Verify that dependency resolution by an aggregator before the build has actually produced any artifacts - * doesn't prevent later resolution of project artifacts from the reactor if the aggregator originally resolved - * them from the remote repo. + * Verify that dependencies which are managed through imported dependency management work * * @throws Exception in case of failure */ @Test - public void testit() + void testBuildSubtree() throws Exception { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4814" ); + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7629" ); Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4814" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArguments( "validate", - "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:aggregate-test" ); + verifier.setAutoclean( true ); + verifier.addCliArgument( "verify" ); verifier.execute(); verifier.verifyErrorFreeLog(); - List<String> compile = verifier.loadLines( "consumer/target/compile.txt", "UTF-8" ); - - assertFalse( compile.toString(), compile.contains( "0.1-SNAPSHOT/producer-0.1-SNAPSHOT.jar" ) ); - assertTrue( compile.toString(), compile.contains( "producer/pom.xml" ) ); + verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( true ); + verifier.addCliArguments( "-f", "child-2", "verify" ); + verifier.execute(); + verifier.verifyErrorFreeLog(); } } diff --git a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java index e5e8e1a53..1e5ab87e3 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java @@ -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 ); diff --git a/core-it-suite/src/test/resources-filtered/bootstrap.txt b/core-it-suite/src/test/resources-filtered/bootstrap.txt index d9ccd06b7..148c05a81 100644 --- a/core-it-suite/src/test/resources-filtered/bootstrap.txt +++ b/core-it-suite/src/test/resources-filtered/bootstrap.txt @@ -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 diff --git a/core-it-suite/src/test/resources/mng-7629/.mvn/placeholder.txt b/core-it-suite/src/test/resources/mng-7629/.mvn/placeholder.txt new file mode 100644 index 000000000..e69de29bb diff --git a/core-it-suite/src/test/resources/mng-7629/child-1/pom.xml b/core-it-suite/src/test/resources/mng-7629/child-1/pom.xml new file mode 100644 index 000000000..8e1845845 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7629/child-1/pom.xml @@ -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> diff --git a/core-it-suite/src/test/resources/mng-7629/child-1/src/main/java/org/apache/maven/its/mng7629/Test.java b/core-it-suite/src/test/resources/mng-7629/child-1/src/main/java/org/apache/maven/its/mng7629/Test.java new file mode 100644 index 000000000..9217ba515 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7629/child-1/src/main/java/org/apache/maven/its/mng7629/Test.java @@ -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 { + +} diff --git a/core-it-suite/src/test/resources/mng-7629/child-1/src/main/mdo/settings.mdo b/core-it-suite/src/test/resources/mng-7629/child-1/src/main/mdo/settings.mdo new file mode 100644 index 000000000..93fa6034a --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7629/child-1/src/main/mdo/settings.mdo @@ -0,0 +1,1083 @@ +<?xml version="1.0"?> + +<!-- + 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. +--> + +<model xmlns="http://codehaus-plexus.github.io/MODELLO/1.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/1.4.0 http://codehaus-plexus.github.io/modello/xsd/modello-1.4.0.xsd" + xml.namespace="http://maven.apache.org/SETTINGS/${version}" + xml.schemaLocation="http://maven.apache.org/xsd/settings-${version}.xsd"> + <id>settings</id> + <name>Settings</name> + <description> + <![CDATA[ + <p>This is a reference for the user-specific configuration for Maven.</p> + <p>Includes things that should not be distributed with the pom.xml file, such as developer identity, along with + local settings, like proxy information.</p> + <p>The default location for the settings file is <i>~/.m2/settings.xml</i></p> + ]]> + </description> + <defaults> + <default> + <key>package</key> + <value>org.apache.maven.settings</value> + </default> + </defaults> + <classes> + <class java.clone="deep"> + <name>TrackableBase</name> + <version>1.0.0+</version> + <description> + common base class that contains code to track the source for + this instance (USER|GLOBAL) + </description> + <codeSegments> + <codeSegment> + <version>1.0.0+</version> + <code> + <![CDATA[ + public static final String USER_LEVEL = "user-level"; + public static final String GLOBAL_LEVEL = "global-level"; + + private String sourceLevel = USER_LEVEL; + private boolean sourceLevelSet = false; + + public void setSourceLevel( String sourceLevel ) + { + if ( sourceLevelSet ) + { + throw new IllegalStateException( "Cannot reset sourceLevel attribute; it is already set to: " + sourceLevel ); + } + else if ( !( USER_LEVEL.equals( sourceLevel ) || GLOBAL_LEVEL.equals( sourceLevel ) ) ) + { + throw new IllegalArgumentException( "sourceLevel must be one of: {" + USER_LEVEL + "," + GLOBAL_LEVEL + "}" ); + } + else + { + this.sourceLevel = sourceLevel; + this.sourceLevelSet = true; + } + } + + public String getSourceLevel() + { + return sourceLevel; + } + ]]> + </code> + </codeSegment> + </codeSegments> + </class> + <class> + <name>IdentifiableBase</name> + <superClass>TrackableBase</superClass> + <version>1.0.0+</version> + <description> + <![CDATA[ + Base class for <code>Mirror</code>, <code>Profile</code>, <code>Proxy</code> and <code>Server</code>. + ]]></description> + <fields> + <field> + <name>id</name> + <version>1.0.0+</version> + <type>String</type> + <defaultValue>default</defaultValue> + <required>true</required> + </field> + </fields> + </class> + <class rootElement="true" xml.tagName="settings"> + <name>Settings</name> + <version>1.0.0+</version> + <superClass>TrackableBase</superClass> + <description> + Root element of the user configuration file. + </description> + <fields> + <field> + <name>localRepository</name> + <version>1.0.0+</version> + <required>true</required> + <description> + <![CDATA[ + The local repository.<br><b>Default value is:</b> <code>${user.home}/.m2/repository</code> + ]]> + </description> + <type>String</type> + </field> + <field> + <name>interactiveMode</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Whether Maven should attempt to interact with the user for input. + ]]> + </description> + <type>boolean</type> + <defaultValue>true</defaultValue> + </field> + <field> + <name>usePluginRegistry</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Whether Maven should use the plugin-registry.xml file to manage plugin versions. + ]]> + </description> + <type>boolean</type> + <defaultValue>false</defaultValue> + </field> + <!-- [JC] Not ready to use yet, so I'm making if unavailable for now. --> + <!-- field> + <name>passwordStore</name> + <version>1.0.0+</version> + <required>false</required> + <description><![CDATA[The keystore used to store passwords.]]></description> + <type>String</type> + </field --> + <field> + <name>offline</name> + <version>1.0.0+</version> + <required>false</required> + <description> + <![CDATA[ + Indicate whether maven should operate in offline mode full-time. + ]]> + </description> + <type>boolean</type> + <defaultValue>false</defaultValue> + </field> + <!-- [JC] Not ready to use yet, so I'm making if unavailable for now. --> + <!-- field> + <name>jdks</name> + <version>1.0.0+</version> + <description><![CDATA[ + Configuration for different java environment profiles. One good use + for this might be to configure both JDK 1.4 and JDK 1.5 to work with + maven. Profiles will allow switching of entire java environments + based on the profile id, either in the defaults section below, or on + the command line. + ]]></description> + <association> + <type>Jdk</type> + <multiplicity>*</multiplicity> + </association> + </field --> + <field xdoc.separator="blank"> + <name>proxies</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Configuration for different proxy profiles. Multiple proxy profiles + might come in handy for anyone working from a notebook or other + mobile platform, to enable easy switching of entire proxy + configurations by simply specifying the profile id, again either from + the command line or from the defaults section below. + ]]> + </description> + <association> + <type>Proxy</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field xdoc.separator="blank"> + <name>servers</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Configuration of server-specific settings, mainly authentication + method. This allows configuration of authentication on a per-server + basis. + ]]> + </description> + <association> + <type>Server</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field xdoc.separator="blank"> + <name>mirrors</name> + <version>1.0.0+</version> + <description> + Configuration of download mirrors for repositories. + </description> + <association> + <type>Mirror</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field xdoc.separator="blank"> + <name>profiles</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Configuration of build profiles for adjusting the build + according to environmental parameters. + ]]> + </description> + <association> + <type>Profile</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field xdoc.separator="blank"> + <name>activeProfiles</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + List of manually-activated build profiles, specified in the order in which + they should be applied. + ]]> + </description> + <association> + <type>String</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> + <name>pluginGroups</name> + <version>1.0.0+</version> + <description> + List of groupIds to search for a plugin when that plugin + groupId is not explicitly provided. + </description> + <association> + <type>String</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.0.0+</version> + <code> + <![CDATA[ + public Boolean getInteractiveMode() + { + return Boolean.valueOf( isInteractiveMode() ); + } + + private Proxy activeProxy; + + /** + * Reset the <code>activeProxy</code> field to <code>null</code> + */ + public void flushActiveProxy() + { + this.activeProxy = null; + } + + /** + * @return the first active proxy + */ + public synchronized Proxy getActiveProxy() + { + if ( activeProxy == null ) + { + java.util.List<Proxy> proxies = getProxies(); + if ( proxies != null && !proxies.isEmpty() ) + { + for ( Proxy proxy : proxies ) + { + if ( proxy.isActive() ) + { + activeProxy = proxy; + break; + } + } + } + } + + return activeProxy; + } + + public Server getServer( String serverId ) + { + Server match = null; + + java.util.List<Server> servers = getServers(); + if ( servers != null && serverId != null ) + { + for ( Server server : servers ) + { + if ( serverId.equals( server.getId() ) ) + { + match = server; + break; + } + } + } + + return match; + } + + @Deprecated + public Mirror getMirrorOf( String repositoryId ) + { + Mirror match = null; + + java.util.List<Mirror> mirrors = getMirrors(); + if ( mirrors != null && repositoryId != null ) + { + for ( Mirror mirror : mirrors ) + { + if ( repositoryId.equals( mirror.getMirrorOf() ) ) + { + match = mirror; + break; + } + } + } + + return match; + } + + private java.util.Map<String, Profile> profileMap; + + /** + * Reset the <code>profileMap</code> field to <code>null</code> + */ + public void flushProfileMap() + { + this.profileMap = null; + } + + /** + * @return a Map of profiles field with <code>Profile#getId()</code> as key + * @see Profile#getId() + */ + public java.util.Map<String, Profile> getProfilesAsMap() + { + if ( profileMap == null ) + { + profileMap = new java.util.LinkedHashMap<String, Profile>(); + + if ( getProfiles() != null ) + { + for ( Profile profile : getProfiles() ) + { + profileMap.put( profile.getId(), profile ); + } + } + } + + return profileMap; + } + ]]> + </code> + </codeSegment> + </codeSegments> + </class> + <!-- @todo: is any of this too CVS specific? Investigate other SCMs --> + <!-- [JC] Commenting out until we're ready to use it... --> + <!-- class> + <name>Jdk</name> + <version>1.0.0+</version> + <superClass>TrackableBase</superClass> + <description><![CDATA[Describes one Java environment]]></description> + <fields> + <field> + <name>active</name> + <version>1.0.0+</version> + <required>false</required> + <defaultValue>false</defaultValue> + <description><![CDATA[Whether this JDK is the active one.]]></description> + <type>boolean</type> + </field> + <field> + <name>version</name> + <version>1.0.0+</version> + <required>true</required> + <description><![CDATA[The JDK major version (eg. '1.4').]]></description> + <type>String</type> + </field> + <field> + <name>javaHome</name> + <version>1.0.0+</version> + <required>true</required> + <description><![CDATA[The JDK home.]]></description> + <type>String</type> + </field> + </fields> + </class --> + <class> + <name>Proxy</name> + <version>1.0.0+</version> + <superClass>IdentifiableBase</superClass> + <description> + <![CDATA[ + The <code><proxy></code> element contains informations required to a proxy settings. + ]]></description> + <fields> + <field> + <name>active</name> + <version>1.0.0+</version> + <required>false</required> + <defaultValue>true</defaultValue> + <description> + <![CDATA[ + Whether this proxy configuration is the active one. + ]]> + </description> + <type>boolean</type> + </field> + <field> + <name>protocol</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The proxy protocol. + ]]> + </description> + <type>String</type> + <defaultValue>http</defaultValue> + </field> + <field> + <name>username</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The proxy user. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>password</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The proxy password. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>port</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The proxy port. + ]]> + </description> + <type>int</type> + <defaultValue>8080</defaultValue> + </field> + <field> + <name>host</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The proxy host. + ]]> + </description> + <type>String</type> + <required>true</required> + </field> + <field> + <name>nonProxyHosts</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The list of non-proxied hosts (delimited by |). + ]]> + </description> + <type>String</type> + </field> + </fields> + </class> + <class> + <name>Server</name> + <version>1.0.0+</version> + <superClass>IdentifiableBase</superClass> + <description> + <![CDATA[ + The <code><server></code> element contains informations required to a server settings. + ]]></description> + <fields> + <field> + <name>username</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The username used to authenticate. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>password</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The password used in conjunction with the username to authenticate. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>privateKey</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The private key location used to authenticate. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>passphrase</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The passphrase used in conjunction with the privateKey to authenticate. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>filePermissions</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The permissions for files when they are created. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>directoryPermissions</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The permissions for directories when they are created. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>configuration</name> + <type>DOM</type> + <description> + <![CDATA[ + Extra configuration for the transport layer. + ]]> + </description> + </field> + </fields> + </class> + <class> + <name>Mirror</name> + <version>1.0.0+</version> + <superClass>IdentifiableBase</superClass> + <description> + A download mirror for a given repository. + </description> + <fields> + <field> + <name>mirrorOf</name> + <required>true</required> + <version>1.0.0+</version> + <type>String</type> + <description> + The server ID of the repository being mirrored, e.g., + "central". This MUST NOT match the mirror id. + </description> + </field> + <field> + <name>name</name> + <required>false</required> + <version>1.0.0+</version> + <type>String</type> + <description> + The optional name that describes the mirror. + </description> + </field> + <field> + <name>url</name> + <required>true</required> + <version>1.0.0+</version> + <type>String</type> + <description>The URL of the mirror repository.</description> + </field> + <field> + <name>layout</name> + <version>1.1.0+</version> + <type>String</type> + <defaultValue>default</defaultValue> + <description>The layout of the mirror repository. Since Maven 3.</description> + </field> + <field> + <name>mirrorOfLayouts</name> + <version>1.1.0+</version> + <type>String</type> + <defaultValue>default,legacy</defaultValue> + <description> + The layouts of repositories being mirrored. This value can be used to restrict the usage + of the mirror to repositories with a matching layout (apart from a matching id). Since Maven 3. + </description> + </field> + <field> + <name>blocked</name> + <version>1.2.0+</version> + <type>boolean</type> + <defaultValue>false</defaultValue> + <description> + Whether this mirror should be blocked from any download request but fail the download process, explaining why. + </description> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.0.0+</version> + <code> + <![CDATA[ + + public String toString() + { + StringBuilder sb = new StringBuilder( 128 ); + sb.append( "Mirror[" ); + sb.append( "id=" ).append( this.getId() ); + sb.append( ",mirrorOf=" ).append( this.getMirrorOf() ); + sb.append( ",url=" ).append( this.getUrl() ); + sb.append( ",name=" ).append( this.getName() ); + if ( isBlocked() ) + { + sb.append( ",blocked" ); + } + sb.append( "]" ); + return sb.toString(); + } + ]]> + </code> + </codeSegment> + </codeSegments> + </class> + <!-- Profile support --> + <class> + <name>Profile</name> + <version>1.0.0+</version> + <superClass>IdentifiableBase</superClass> + <description> + <![CDATA[ + Modifications to the build process which is keyed on some + sort of environmental parameter. + ]]> + </description> + <fields> + <field> + <name>activation</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The conditional logic which will automatically + trigger the inclusion of this profile. + ]]> + </description> + <association> + <type>Activation</type> + </association> + </field> + <field> + <name>properties</name> + <description> + <![CDATA[ + Extended configuration specific to this profile goes here. + Contents take the form of + <code><property.name>property.value</property.name></code> + ]]> + </description> + <type>Properties</type> + <association xml.mapStyle="inline"> + <type>String</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field xdoc.separator="blank"> + <name>repositories</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The lists of the remote repositories. + ]]> + </description> + <association> + <type>Repository</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> + <name>pluginRepositories</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The lists of the remote repositories for discovering plugins. + ]]> + </description> + <association> + <type>Repository</type> + <multiplicity>*</multiplicity> + </association> + <comment> + <![CDATA[ + This may be removed or relocated in the near + future. It is undecided whether plugins really need a remote + repository set of their own. + ]]> + </comment> + </field> + </fields> + </class> + <class java.clone="deep"> + <name>Activation</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The conditions within the build runtime environment which will trigger + the automatic inclusion of the parent build profile. + ]]> + </description> + <fields> + <field> + <name>activeByDefault</name> + <version>1.0.0+</version> + <type>boolean</type> + <description> + Flag specifying whether this profile is active as a default. + </description> + </field> + <field> + <name>jdk</name> + <version>1.0.0+</version> + <type>String</type> + <description> + <![CDATA[ + Specifies that this profile will be activated when a matching JDK is detected. + ]]> + </description> + </field> + <field> + <name>os</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Specifies that this profile will be activated when matching OS attributes are detected. + ]]> + </description> + <association> + <type>ActivationOS</type> + </association> + </field> + <field> + <name>property</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Specifies that this profile will be activated when this property is specified. + ]]> + </description> + <association> + <type>ActivationProperty</type> + </association> + </field> + <field> + <name>file</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Specifies that this profile will be activated based on existence of a file. + ]]> + </description> + <association> + <type>ActivationFile</type> + </association> + </field> + </fields> + </class> + + <!-- TODO: reproduced from maven-model/maven.mdo, instead should inherit code and link to external docs --> + <class java.clone="deep"> + <name>RepositoryBase</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Repository contains the information needed + for establishing connections with remote repository + ]]> + </description> + <fields> + <field> + <name>id</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + A unique identifier for a repository. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>name</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + Human readable name of the repository. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>url</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + The url of the repository. + ]]> + </description> + <type>String</type> + </field> + <field> + <name>layout</name> + <version>1.0.0+</version> + <description> + The type of layout this repository uses for locating and + storing artifacts - can be "legacy" or "default". + </description> + <type>String</type> + <defaultValue>default</defaultValue> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.0.0+</version> + <code> + <![CDATA[ + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals( Object obj ) + { + RepositoryBase other = (RepositoryBase) obj; + boolean retValue = false; + if ( this.getId() != null ) + { + retValue = this.getId().equals( other.getId() ); + } + return retValue; + } + ]]> + </code> + </codeSegment> + </codeSegments> + </class> + + <class> + <name>Repository</name> + <superClass>RepositoryBase</superClass> + <version>1.0.0+</version> + <description> + Repository contains the information needed for establishing + connections with remote repository + </description> + <fields> + <field> + <name>releases</name> + <version>1.0.0+</version> + <description> + How to handle downloading of releases from this repository + </description> + <association> + <type>RepositoryPolicy</type> + </association> + </field> + <field> + <name>snapshots</name> + <version>1.0.0+</version> + <description> + How to handle downloading of snapshots from this repository + </description> + <association> + <type>RepositoryPolicy</type> + </association> + </field> + </fields> + <!-- prevent Modello generation of an incorrect equals method. Could be avoided by using <identity/> tags to mark ID as the only identity field --> + <codeSegments> + <codeSegment> + <version>1.0.0+</version> + <code> + <![CDATA[ + /** + * @see RepositoryBase#equals(java.lang.Object) + */ + public boolean equals( Object obj ) + { + return super.equals( obj ); + } + ]]> + </code> + </codeSegment> + </codeSegments> + </class> + + <class java.clone="deep"> + <name>RepositoryPolicy</name> + <version>1.0.0+</version> + <description>Download policy</description> + <fields> + <field> + <name>enabled</name> + <version>1.0.0+</version> + <description> + Whether to use this repository for downloading this type of + artifact. + </description> + <type>boolean</type> + <defaultValue>true</defaultValue> + </field> + <field> + <name>updatePolicy</name> + <version>1.0.0+</version> + <description> + The frequency for downloading updates - can be "always", + "daily" (default), "interval:XXX" (in minutes) or "never" + (only if it doesn't exist locally). + </description> + <type>String</type> + </field> + <field> + <name>checksumPolicy</name> + <version>1.0.0+</version> + <description> + What to do when verification of an artifact checksum fails. Valid values are "fail" (default for Maven 4 and + above), "warn" (default for Maven 2 and 3) or "ignore". + </description> + <type>String</type> + </field> + </fields> + </class> + + <class java.clone="deep"> + <name>ActivationProperty</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + This is the property specification used to activate a profile. If the value field is empty, + then the existence of the named property will activate the profile, otherwise it does a case-sensitive + match against the property value as well. + ]]> + </description> + <fields> + <field> + <name>name</name> + <version>1.0.0+</version> + <type>String</type> + <required>true</required> + <description> + The name of the property to be used to activate a profile. + </description> + </field> + <field> + <name>value</name> + <version>1.0.0+</version> + <type>String</type> + <description> + The value of the property to be used to activate a profile. + </description> + </field> + </fields> + </class> + <class java.clone="deep"> + <name>ActivationOS</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + This is an activator which will detect an operating system's attributes in order to activate + its profile. + ]]> + </description> + <fields> + <field> + <name>name</name> + <version>1.0.0+</version> + <type>String</type> + <description> + The name of the OS to be used to activate a profile. + </description> + </field> + <field> + <name>family</name> + <version>1.0.0+</version> + <type>String</type> + <description> + The general family of the OS to be used to activate a + profile (e.g. 'windows') + </description> + </field> + <field> + <name>arch</name> + <version>1.0.0+</version> + <type>String</type> + <description> + The architecture of the OS to be used to activate a profile. + </description> + </field> + <field> + <name>version</name> + <version>1.0.0+</version> + <type>String</type> + <description> + The version of the OS to be used to activate a profile. + </description> + </field> + </fields> + </class> + <class java.clone="deep"> + <name>ActivationFile</name> + <version>1.0.0+</version> + <description> + <![CDATA[ + This is the file specification used to activate a profile. The missing value will be a the location + of a file that needs to exist, and if it doesn't the profile must run. On the other hand exists will test + for the existence of the file and if it is there will run the profile. + ]]> + </description> + <fields> + <field> + <name>missing</name> + <version>1.0.0+</version> + <type>String</type> + <description> + The name of the file that should be missing to activate a + profile. + </description> + </field> + <field> + <name>exists</name> + <version>1.0.0+</version> + <type>String</type> + <description> + The name of the file that should exist to activate a profile. + </description> + </field> + </fields> + </class> + <!-- /BuildProfile support --> + </classes> +</model> diff --git a/core-it-suite/src/test/resources/mng-7629/child-2/pom.xml b/core-it-suite/src/test/resources/mng-7629/child-2/pom.xml new file mode 100644 index 000000000..b559a57ac --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7629/child-2/pom.xml @@ -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> diff --git a/core-it-suite/src/test/resources/mng-7629/pom.xml b/core-it-suite/src/test/resources/mng-7629/pom.xml new file mode 100644 index 000000000..dae9ae7ce --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7629/pom.xml @@ -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>