You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2015/02/16 23:32:10 UTC
svn commit: r1660235 -
/maven/plugins/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java
Author: rfscholte
Date: Mon Feb 16 22:32:09 2015
New Revision: 1660235
URL: http://svn.apache.org/r1660235
Log:
Add failOnWarning
Modified:
maven/plugins/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java
Modified: maven/plugins/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java?rev=1660235&r1=1660234&r2=1660235&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java (original)
+++ maven/plugins/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java Mon Feb 16 22:32:09 2015
@@ -66,6 +66,12 @@ public abstract class AbstractJDepsMojo
private File outputDirectory;
/**
+ * Indicates whether the build will continue even if there are jdeps warnings.
+ */
+ @Parameter( defaultValue = "true" )
+ private boolean failOnWarning;
+
+ /**
* Destination directory for DOT file output
*/
@Parameter( property = "jdeps.dotOutput" )
@@ -117,11 +123,20 @@ public abstract class AbstractJDepsMojo
private boolean profile;
/**
- * Recursively traverse all dependencies
+ * Recursively traverse all dependencies. The {@code -R} option implies {@code -filter:none}. If {@code -p},
+ * {@code -e}, {@code -f} option is specified, only the matching dependences are analyzed.
*/
@Parameter( defaultValue = "false", property = "jdeps.recursive" )
private boolean recursive;
+ /**
+ * Show module containing the package
+ *
+ * @since JDK 1.9.0
+ */
+ @Parameter( defaultValue = "false", property = "jdeps.module" )
+ private boolean module;
+
@Component
private ToolchainManager toolchainManager;
@@ -157,7 +172,7 @@ public abstract class AbstractJDepsMojo
addJDepsClasses( cmd );
JDepsConsumer consumer = new JDepsConsumer();
- executeJavadocCommandLine( cmd, outputDirectory, consumer );
+ executeJDepsCommandLine( cmd, outputDirectory, consumer );
// @ TODO if there will be more goals, this should be pushed down to AbstractJDKInternals
if ( consumer.getOffendingPackages().size() > 0 )
@@ -171,7 +186,11 @@ public abstract class AbstractJDepsMojo
msg.append( ' ' ).append( offendingPackage.getKey() )
.append( " -> " ).append( offendingPackage.getValue() ).append( ls );
}
- throw new MojoExecutionException( msg.toString() );
+
+ if ( failOnWarning )
+ {
+ throw new MojoExecutionException( msg.toString() );
+ }
}
}
@@ -240,6 +259,11 @@ public abstract class AbstractJDepsMojo
{
cmd.createArg().setValue( "-P" );
}
+
+ if ( module )
+ {
+ cmd.createArg().setValue( "-M" );
+ }
if ( apiOnly )
{
@@ -297,7 +321,7 @@ public abstract class AbstractJDepsMojo
}
// ----------------------------------------------------------------------
- // Try to find javadocExe from System.getProperty( "java.home" )
+ // Try to find jdepsExe from System.getProperty( "java.home" )
// By default, System.getProperty( "java.home" ) = JRE_HOME and JRE_HOME
// should be in the JDK_HOME
// ----------------------------------------------------------------------
@@ -321,7 +345,7 @@ public abstract class AbstractJDepsMojo
}
// ----------------------------------------------------------------------
- // Try to find javadocExe from JAVA_HOME environment variable
+ // Try to find jdepsExe from JAVA_HOME environment variable
// ----------------------------------------------------------------------
if ( !jdepsExe.exists() || !jdepsExe.isFile() )
{
@@ -350,7 +374,7 @@ public abstract class AbstractJDepsMojo
return jdepsExe.getAbsolutePath();
}
- private void executeJavadocCommandLine( Commandline cmd, File jOutputDirectory,
+ private void executeJDepsCommandLine( Commandline cmd, File jOutputDirectory,
CommandLineUtils.StringStreamConsumer consumer )
throws MojoExecutionException
{
@@ -408,7 +432,7 @@ public abstract class AbstractJDepsMojo
}
// ----------------------------------------------------------------------
- // Handle Javadoc warnings
+ // Handle JDeps warnings
// ----------------------------------------------------------------------
if ( StringUtils.isNotEmpty( err.getOutput() ) && getLog().isWarnEnabled() )