Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void testIT()

Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.deleteDirectory( "child2/target" );
verifier.deleteDirectory( "child3/target" );
verifier.addCliArgument( "initialize" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void testitTestPhase()

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" );
Expand Down Expand Up @@ -113,6 +114,7 @@ public void testitPackagePhase()

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" );
Expand All @@ -122,37 +124,39 @@ public void testitPackagePhase()
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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ public void testShouldWarnWhenPackagedArtifactIsOutdated() throws Exception
{
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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void testit()

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" );
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public TestSuiteOrdering()
* 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 );
Expand Down
1 change: 1 addition & 0 deletions core-it-suite/src/test/resources-filtered/bootstrap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file.
63 changes: 63 additions & 0 deletions core-it-suite/src/test/resources/mng-7629/child-1/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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 {

}
Loading