diff --git a/src/it/it-dependency-updates-report-003/invoker.properties b/src/it/it-dependency-updates-report-003/invoker.properties
new file mode 100644
index 0000000000..c01f7db0e4
--- /dev/null
+++ b/src/it/it-dependency-updates-report-003/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=site
diff --git a/src/it/it-dependency-updates-report-003/pom.xml b/src/it/it-dependency-updates-report-003/pom.xml
new file mode 100644
index 0000000000..6250f376eb
--- /dev/null
+++ b/src/it/it-dependency-updates-report-003/pom.xml
@@ -0,0 +1,93 @@
+
+ 4.0.0
+ localhost
+ it-dependency-updates-report-003
+ 1.0
+ pom
+ dependency-updates-report
+ http://localhost/
+
+
+ false
+
+
+
+
+
+ localhost
+ dummy-api
+ 2.0
+
+
+
+
+
+ localhost
+ dummy-api
+ 1.1
+
+
+
+
+
+
+ localhost
+ dummy-maven-plugin
+ 1.0
+
+
+ localhost
+ dummy-api
+ 1.1
+
+
+
+
+ maven-clean-plugin
+ 2.2
+
+
+ maven-deploy-plugin
+ 2.3
+
+
+ maven-install-plugin
+ 2.2
+
+
+ maven-site-plugin
+ @sitePluginVersion@
+
+
+ maven-project-info-reports-plugin
+ 2.1
+
+
+
+
+
+
+
+
+ maven-project-info-reports-plugin
+ 2.1
+
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ dependency-updates-report
+
+
+
+
+
+
+
diff --git a/src/it/it-dependency-updates-report-003/src/site/site.xml b/src/it/it-dependency-updates-report-003/src/site/site.xml
new file mode 100644
index 0000000000..854b5fbbc1
--- /dev/null
+++ b/src/it/it-dependency-updates-report-003/src/site/site.xml
@@ -0,0 +1,7 @@
+
+
+ org.apache.maven.skins
+ maven-default-skin
+ 1.0
+
+
\ No newline at end of file
diff --git a/src/it/it-dependency-updates-report-003/verify.bsh b/src/it/it-dependency-updates-report-003/verify.bsh
new file mode 100644
index 0000000000..b9f302ee44
--- /dev/null
+++ b/src/it/it-dependency-updates-report-003/verify.bsh
@@ -0,0 +1,33 @@
+import java.io.*;
+import org.codehaus.plexus.util.FileUtils;
+
+try
+{
+ File file = new File( basedir, "target/site/dependency-updates-report.html" );
+ String buf = FileUtils.fileRead( file, "UTF-8" );
+
+ String result = buf.toString()
+ .replaceAll( "<[^>]+>", " " )
+ .replaceAll( "&[^;]+;", " " )
+ .replaceAll( "\\s+", " " );
+
+ if ( result.indexOf( "localhost dummy-api 1.1 compile jar 1.1.0-2 1.1.1 1.2 2.0" ) < 0 )
+ {
+ System.out.println( "Did not pick up updated in dependencies section" );
+ System.out.println( "Result = \"" + result +"\"" );
+ return false;
+ }
+ if ( !result.contains("This project does not declare any dependencies in a dependencyManagement section."))
+ {
+ System.out.println( "Did not ignore dependencyManagement" );
+ System.out.println( "Result = \"" + result +"\"" );
+ return false;
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
\ No newline at end of file
diff --git a/src/it/it-dependency-updates-report-004/invoker.properties b/src/it/it-dependency-updates-report-004/invoker.properties
new file mode 100644
index 0000000000..c01f7db0e4
--- /dev/null
+++ b/src/it/it-dependency-updates-report-004/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=site
diff --git a/src/it/it-dependency-updates-report-004/pom.xml b/src/it/it-dependency-updates-report-004/pom.xml
new file mode 100644
index 0000000000..1443a408e3
--- /dev/null
+++ b/src/it/it-dependency-updates-report-004/pom.xml
@@ -0,0 +1,96 @@
+
+ 4.0.0
+ localhost
+ it-dependency-updates-report-004
+ 1.0
+ pom
+ dependency-updates-report
+ http://localhost/
+
+
+ using the default for processDependencyManagement.
+
+
+
+
+ localhost
+ dummy-api
+ 1.1
+
+
+ localhost
+ dummy-impl
+ 1.1
+
+
+
+
+
+ localhost
+ dummy-api
+
+
+
+
+
+
+ localhost
+ dummy-maven-plugin
+ 1.0
+
+
+ localhost
+ dummy-api
+ 1.1
+
+
+
+
+ maven-clean-plugin
+ 2.2
+
+
+ maven-deploy-plugin
+ 2.3
+
+
+ maven-install-plugin
+ 2.2
+
+
+ maven-site-plugin
+ @sitePluginVersion@
+
+
+ maven-project-info-reports-plugin
+ 2.1
+
+
+
+
+
+
+
+
+ maven-project-info-reports-plugin
+ 2.1
+
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ dependency-updates-report
+
+
+
+
+
+
+
diff --git a/src/it/it-dependency-updates-report-004/src/site/site.xml b/src/it/it-dependency-updates-report-004/src/site/site.xml
new file mode 100644
index 0000000000..854b5fbbc1
--- /dev/null
+++ b/src/it/it-dependency-updates-report-004/src/site/site.xml
@@ -0,0 +1,7 @@
+
+
+ org.apache.maven.skins
+ maven-default-skin
+ 1.0
+
+
\ No newline at end of file
diff --git a/src/it/it-dependency-updates-report-004/verify.bsh b/src/it/it-dependency-updates-report-004/verify.bsh
new file mode 100644
index 0000000000..a5102914ce
--- /dev/null
+++ b/src/it/it-dependency-updates-report-004/verify.bsh
@@ -0,0 +1,39 @@
+import java.io.*;
+import org.codehaus.plexus.util.FileUtils;
+
+try
+{
+ File file = new File( basedir, "target/site/dependency-updates-report.html" );
+ String buf = FileUtils.fileRead( file, "UTF-8" );
+
+ String result = buf.toString()
+ .replaceAll( "<[^>]+>", " " )
+ .replaceAll( "&[^;]+;", " " )
+ .replaceAll( "\\s+", " " );
+
+ if ( !result.contains( "localhost dummy-api 1.1 jar 1.1.0-2 1.1.1 1.2 2.0" ) )
+ {
+ System.out.println( "Did not pick up updated in Dependency Management section" );
+ System.out.println( "Result = \"" + result +"\"" );
+ return false;
+ }
+ if ( !result.contains( "localhost dummy-impl 1.1 jar 1.2 2.0" ) )
+ {
+ System.out.println( "Did not pick up updated in Dependency Management section" );
+ System.out.println( "Result = \"" + result +"\"" );
+ return false;
+ }
+ if ( !result.contains( "This project does not declare any dependencies." ) )
+ {
+ System.out.println( "Dependency Management should have processed" );
+ System.out.println( "Result = \"" + result +"\"" );
+ return false;
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
diff --git a/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReport.java b/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReport.java
index 46c25ff729..66008a9129 100644
--- a/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReport.java
+++ b/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReport.java
@@ -24,6 +24,7 @@
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.mojo.versions.api.ArtifactVersions;
@@ -49,6 +50,14 @@ public class DependencyUpdatesReport
extends AbstractVersionsReport
{
+ /**
+ * Whether to process the dependencyManagement
in pom or not.
+ *
+ * @since 2.5
+ */
+ @Parameter( property = "processDependencyManagement", defaultValue = "true" )
+ private boolean processDependencyManagement;
+
/**
* Report formats (html and/or xml). HTML by default.
*
@@ -81,20 +90,28 @@ public boolean canGenerateReport()
protected void doGenerateReport( Locale locale, Sink sink )
throws MavenReportException
{
+ Set dependencies = new TreeSet( new DependencyComparator() );
+ dependencies.addAll( getProject().getDependencies() );
+
Set dependencyManagement = new TreeSet( new DependencyComparator() );
- dependencyManagement.addAll( getProject().getDependencyManagement() == null ? Collections.EMPTY_LIST
+ dependencyManagement.addAll( getProject().getDependencyManagement() == null ? Collections.emptySet()
: getProject().getDependencyManagement().getDependencies() );
- Set dependencies = new TreeSet( new DependencyComparator() );
- dependencies.addAll( getProject().getDependencies() );
- dependencies = removeDependencyManagment( dependencies, dependencyManagement );
+ if ( processDependencyManagement )
+ {
+ dependencies = removeDependencyManagment( dependencies, dependencyManagement );
+ }
try
{
Map dependencyUpdates =
getHelper().lookupDependenciesUpdates( dependencies, false );
- Map dependencyManagementUpdates =
- getHelper().lookupDependenciesUpdates( dependencyManagement, false );
+
+ Map dependencyManagementUpdates = Collections.emptyMap();
+ if ( processDependencyManagement )
+ {
+ dependencyManagementUpdates = getHelper().lookupDependenciesUpdates( dependencyManagement, false );
+ }
for ( String format : formats )
{
if ( "html".equals( format ) )