mirror of https://github.com/apache/maven.git
[MNG-6229] Write out optionality in Core IT Plugins for collection and resolution
Write out " (optional)" in the log entry as well as to the file for later analysis.
This commit is contained in:
parent
e2c15f1a90
commit
9abd8fdc48
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-947">MNG-947</a>.
|
||||
*
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
public class MavenITmng0947OptionalDependencyTest
|
||||
|
@ -60,20 +60,20 @@ public class MavenITmng0947OptionalDependencyTest
|
|||
verifier.resetStreams();
|
||||
|
||||
List<String> compile = verifier.loadLines( "target/compile.txt", "UTF-8" );
|
||||
assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:d:jar:0.1" ) );
|
||||
assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:e:jar:0.1" ) );
|
||||
assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:d:jar:0.1 (optional)" ) );
|
||||
assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:e:jar:0.1 (optional)" ) );
|
||||
assertEquals( 2, compile.size() );
|
||||
|
||||
List<String> runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" );
|
||||
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:c:jar:0.1" ) );
|
||||
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:d:jar:0.1" ) );
|
||||
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:e:jar:0.1" ) );
|
||||
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:d:jar:0.1 (optional)" ) );
|
||||
assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:e:jar:0.1 (optional)" ) );
|
||||
assertEquals( 3, runtime.size() );
|
||||
|
||||
List<String> test = verifier.loadLines( "target/test.txt", "UTF-8" );
|
||||
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:c:jar:0.1" ) );
|
||||
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:d:jar:0.1" ) );
|
||||
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:e:jar:0.1" ) );
|
||||
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:d:jar:0.1 (optional)" ) );
|
||||
assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:e:jar:0.1 (optional)" ) );
|
||||
assertEquals( 3, test.size() );
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,14 @@ public abstract class AbstractDependencyMojo
|
|||
{
|
||||
Artifact artifact = (Artifact) artifact1;
|
||||
writer.write( artifact.getId() );
|
||||
String optional = "";
|
||||
if ( artifact.isOptional() )
|
||||
{
|
||||
optional = " (optional)";
|
||||
writer.write( optional );
|
||||
}
|
||||
writer.newLine();
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getId() );
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getId() + optional );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,8 +100,14 @@ public abstract class AbstractDependencyMojo
|
|||
Artifact artifact = (Artifact) artifact1;
|
||||
String id = getId( artifact );
|
||||
writer.write( id );
|
||||
String optional = "";
|
||||
if ( artifact.isOptional() )
|
||||
{
|
||||
optional = " (optional)";
|
||||
writer.write( optional );
|
||||
}
|
||||
writer.newLine();
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + id );
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + id + optional );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue