[MNG-5935] Optional true getting lost in managed dependencies when transitive

This commit is contained in:
Michael Osipov 2017-05-09 08:19:42 +02:00
parent 9abd8fdc48
commit 3d272dd5e2
3 changed files with 145 additions and 0 deletions

View File

@ -114,6 +114,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng6173GetProjectsAndDependencyGraphTest.class );
suite.addTestSuite( MavenITmng6173GetAllProjectsInReactorTest.class );
suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class );
suite.addTestSuite( MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.class );
suite.addTestSuite( MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.class );
suite.addTestSuite( MavenITmng5889FindBasedir.class );
suite.addTestSuite( MavenITmng5840ParentVersionRanges.class );

View File

@ -0,0 +1,61 @@
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 java.io.File;
import java.util.List;
import org.apache.maven.it.util.ResourceExtractor;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-5935">MNG-5935</a>.
*
*/
public class MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest()
{
super( "[3.5.1,)" );
}
public void testitMNG5935()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5935-optional-lost-in-transtive-managed-dependencies" );
Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
List<String> dependencies = verifier.loadLines( "target/dependencies.txt", "UTF-8" );
assertEquals( 5, dependencies.size() );
assertEquals( "com.mysema.querydsl:querydsl-core:jar:3.4.3 (optional)", dependencies.get( 0 ) );
assertEquals( "com.google.guava:guava:jar:17.0 (optional)", dependencies.get( 1 ) );
assertEquals( "com.google.code.findbugs:jsr305:jar:2.0.3 (optional)", dependencies.get( 2 ) );
assertEquals( "com.mysema.commons:mysema-commons-lang:jar:0.2.4 (optional)", dependencies.get( 3 ) );
assertEquals( "com.infradna.tool:bridge-method-annotation:jar:1.13 (optional)", dependencies.get( 4 ) );
}
}

View File

@ -0,0 +1,83 @@
<?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.mng5935</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<name>Maven Integration Test :: MNG-5935</name>
<description>
Verify that optional state true does not get lost in managed dependencies when transitive.
</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-core</artifactId>
<version>3.4.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-core</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<compileArtifacts>target/dependencies.txt</compileArtifacts>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>