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 2018/12/19 21:48:06 UTC

[maven-javadoc-plugin] branch MJAVADOC-526 created (now 7f02059)

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a change to branch MJAVADOC-526
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git.


      at 7f02059  [MJAVADOC-526] aggregate goal doesn't respect managed dependencies

This branch includes the following new commits:

     new 7f02059  [MJAVADOC-526] aggregate goal doesn't respect managed dependencies

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-javadoc-plugin] 01/01: [MJAVADOC-526] aggregate goal doesn't respect managed dependencies

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MJAVADOC-526
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 7f02059e97c9b8f1ef75f182b2edfa54e5001ecc
Author: rfscholte <rf...@apache.org>
AuthorDate: Wed Dec 19 22:47:59 2018 +0100

    [MJAVADOC-526] aggregate goal doesn't respect managed dependencies
---
 pom.xml                                            |  2 +-
 .../invoker.properties                             | 18 ++++++++
 .../javadoc-child/pom.xml                          | 54 ++++++++++++++++++++++
 .../com/leokom/javadoc/JavadocMavenBugDemo.java    | 32 +++++++++++++
 .../projects/MJAVADOC-526_aggr-managedDeps/pom.xml | 48 +++++++++++++++++++
 .../maven/plugins/javadoc/AbstractJavadocMojo.java | 22 +++++----
 .../plugins/javadoc/resolver/ResourceResolver.java |  6 +--
 7 files changed, 170 insertions(+), 12 deletions(-)

diff --git a/pom.xml b/pom.xml
index f936738..563eea9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -189,7 +189,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-artifact-transfer</artifactId>
-      <version>0.9.1</version>
+      <version>0.10.1</version>
     </dependency>
 
     <!-- Doxia -->
diff --git a/src/it/projects/MJAVADOC-526_aggr-managedDeps/invoker.properties b/src/it/projects/MJAVADOC-526_aggr-managedDeps/invoker.properties
new file mode 100644
index 0000000..fd7d8ec
--- /dev/null
+++ b/src/it/projects/MJAVADOC-526_aggr-managedDeps/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals=javadoc:aggregate
diff --git a/src/it/projects/MJAVADOC-526_aggr-managedDeps/javadoc-child/pom.xml b/src/it/projects/MJAVADOC-526_aggr-managedDeps/javadoc-child/pom.xml
new file mode 100644
index 0000000..7016415
--- /dev/null
+++ b/src/it/projects/MJAVADOC-526_aggr-managedDeps/javadoc-child/pom.xml
@@ -0,0 +1,54 @@
+<?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>com.leokom</groupId>
+    <artifactId>javadoc-parent</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>javadoc-child</artifactId>
+
+  <dependencies>
+	<dependency>
+	    <groupId>org.springframework.security</groupId>
+	    <artifactId>spring-security-acl</artifactId>
+	    <version>2.0.4</version>
+	    <scope>runtime</scope>
+	</dependency>
+  </dependencies>
+  
+  <dependencyManagement>
+  	<dependencies>
+  		<dependency>
+  			<groupId>org.springframework.security</groupId>
+  			<artifactId>spring-security-core</artifactId>
+  			<version>2.0.4</version>
+  			<!-- Overriding the runtime scope -->
+  			<scope>compile</scope>
+  		</dependency>
+  	</dependencies>
+  </dependencyManagement>
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-526_aggr-managedDeps/javadoc-child/src/main/java/com/leokom/javadoc/JavadocMavenBugDemo.java b/src/it/projects/MJAVADOC-526_aggr-managedDeps/javadoc-child/src/main/java/com/leokom/javadoc/JavadocMavenBugDemo.java
new file mode 100644
index 0000000..cccdbd5
--- /dev/null
+++ b/src/it/projects/MJAVADOC-526_aggr-managedDeps/javadoc-child/src/main/java/com/leokom/javadoc/JavadocMavenBugDemo.java
@@ -0,0 +1,32 @@
+package com.leokom.javadoc;
+
+/*
+ * 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.springframework.security.BadCredentialsException;
+
+public class JavadocMavenBugDemo {
+	/**
+	 * @throws BadCredentialsException
+	 * @param args unused
+	 */
+	public static void main(String[] args) {
+		throw new BadCredentialsException("Demo");
+	}
+}
diff --git a/src/it/projects/MJAVADOC-526_aggr-managedDeps/pom.xml b/src/it/projects/MJAVADOC-526_aggr-managedDeps/pom.xml
new file mode 100644
index 0000000..e44f89f
--- /dev/null
+++ b/src/it/projects/MJAVADOC-526_aggr-managedDeps/pom.xml
@@ -0,0 +1,48 @@
+<?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>
+  <groupId>com.leokom</groupId>
+  <artifactId>javadoc-parent</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  
+  <url>https://issues.apache.org/jira/browse/MJAVADOC-526</url>
+  
+  <build>
+  	<pluginManagement>
+  		<plugins>
+  			<plugin>
+  				<groupId>org.apache.maven.plugins</groupId>
+  				<artifactId>maven-javadoc-plugin</artifactId>
+  				<version>@project.version@</version>
+  			</plugin>
+  		</plugins>
+  	</pluginManagement>
+  </build>
+
+  <modules>
+    <module>javadoc-child</module>
+  </modules>
+</project>
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index 88b83bc..523014e 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -61,18 +61,18 @@ import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.reporting.MavenReportException;
 import org.apache.maven.settings.Proxy;
 import org.apache.maven.settings.Settings;
-import org.apache.maven.shared.artifact.DefaultArtifactCoordinate;
+import org.apache.maven.shared.transfer.artifact.DefaultArtifactCoordinate;
 import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
 import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter;
 import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter;
 import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter;
 import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
-import org.apache.maven.shared.artifact.resolve.ArtifactResolver;
-import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
-import org.apache.maven.shared.artifact.resolve.ArtifactResult;
-import org.apache.maven.shared.dependencies.DefaultDependableCoordinate;
-import org.apache.maven.shared.dependencies.resolve.DependencyResolver;
-import org.apache.maven.shared.dependencies.resolve.DependencyResolverException;
+import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver;
+import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException;
+import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult;
+import org.apache.maven.shared.transfer.dependencies.DefaultDependableCoordinate;
+import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver;
+import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException;
 import org.apache.maven.shared.invoker.MavenInvocationException;
 import org.apache.maven.toolchain.Toolchain;
 import org.apache.maven.toolchain.ToolchainManager;
@@ -2685,10 +2685,16 @@ public abstract class AbstractJavadocMojo
                         buildingRequest =
                             buildingRequest.setRemoteRepositories( subProject.getRemoteArtifactRepositories() );
                         
+                        List<Dependency> managedDependencies = null;
+                        if ( subProject.getDependencyManagement() != null )
+                        {
+                            managedDependencies = subProject.getDependencyManagement().getDependencies();
+                        }
+                        
                         for ( ArtifactResult artifactResult
                                     : dependencyResolver.resolveDependencies( buildingRequest,
                                                                               subProject.getDependencies(),
-                                                                              null,
+                                                                              managedDependencies,
                                                                               dependencyFilter ) )
                         {
                             populateCompileArtifactMap( compileArtifactMap,
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java b/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
index f028e24..5e3eeda 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
@@ -51,9 +51,9 @@ import org.apache.maven.plugins.javadoc.options.JavadocOptions;
 import org.apache.maven.plugins.javadoc.options.io.xpp3.JavadocOptionsXpp3Reader;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.artifact.filter.resolve.transform.ArtifactIncludeFilterTransformer;
-import org.apache.maven.shared.artifact.resolve.ArtifactResolver;
-import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
-import org.apache.maven.shared.dependencies.resolve.DependencyResolver;
+import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver;
+import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException;
+import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.UnArchiver;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;