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 2021/04/30 10:47:14 UTC

[maven-javadoc-plugin] 07/07: [MJAVADOC-634] Error in test-aggregate-no-fork when using modules

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

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

commit 6230a05719c7e6d9f603cc0a09c2d304fd72424b
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Apr 30 12:46:41 2021 +0200

    [MJAVADOC-634] Error in test-aggregate-no-fork when using modules
---
 .../invoker.properties                             | 18 ++++++++
 .../MJAVADOC-634-module-testreports/pom.xml        | 52 ++++++++++++++++++++++
 .../src/main/java/foo/Bar.java                     | 33 ++++++++++++++
 .../src/main/java/module-info.java                 | 23 ++++++++++
 .../src/test/java/foo/BarTest.java                 | 33 ++++++++++++++
 .../maven/plugins/javadoc/AbstractJavadocMojo.java |  4 +-
 6 files changed, 160 insertions(+), 3 deletions(-)

diff --git a/src/it/projects/MJAVADOC-634-module-testreports/invoker.properties b/src/it/projects/MJAVADOC-634-module-testreports/invoker.properties
new file mode 100644
index 0000000..83ac9c9
--- /dev/null
+++ b/src/it/projects/MJAVADOC-634-module-testreports/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.java.version = 11+
+invoker.goals = verify javadoc:test-aggregate-no-fork 
diff --git a/src/it/projects/MJAVADOC-634-module-testreports/pom.xml b/src/it/projects/MJAVADOC-634-module-testreports/pom.xml
new file mode 100644
index 0000000..83f9fdc
--- /dev/null
+++ b/src/it/projects/MJAVADOC-634-module-testreports/pom.xml
@@ -0,0 +1,52 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>foo</groupId>
+  <artifactId>bar</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.8.1</version>
+          <configuration>
+            <release>11</release>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>@project.version@</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/src/it/projects/MJAVADOC-634-module-testreports/src/main/java/foo/Bar.java b/src/it/projects/MJAVADOC-634-module-testreports/src/main/java/foo/Bar.java
new file mode 100644
index 0000000..5c73698
--- /dev/null
+++ b/src/it/projects/MJAVADOC-634-module-testreports/src/main/java/foo/Bar.java
@@ -0,0 +1,33 @@
+package foo;
+
+/*
+ * 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.
+ */
+
+/**
+ * Bar.
+ */
+public class Bar
+{
+
+    public void run()
+    {
+        System.out.println( "Bar" );
+    }
+
+}
diff --git a/src/it/projects/MJAVADOC-634-module-testreports/src/main/java/module-info.java b/src/it/projects/MJAVADOC-634-module-testreports/src/main/java/module-info.java
new file mode 100644
index 0000000..0c2a1d2
--- /dev/null
+++ b/src/it/projects/MJAVADOC-634-module-testreports/src/main/java/module-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/**
+ * Foo.
+ */
+module foo {
+}
diff --git a/src/it/projects/MJAVADOC-634-module-testreports/src/test/java/foo/BarTest.java b/src/it/projects/MJAVADOC-634-module-testreports/src/test/java/foo/BarTest.java
new file mode 100644
index 0000000..4785b0d
--- /dev/null
+++ b/src/it/projects/MJAVADOC-634-module-testreports/src/test/java/foo/BarTest.java
@@ -0,0 +1,33 @@
+package foo;
+
+/*
+ * 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.
+ */
+
+/**
+ * BarTest.
+ */
+public class BarTest
+{
+
+    public void run()
+    {
+        System.out.println( "BarTest" );
+    }
+
+}
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 f44dab3..add99dd 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -4538,8 +4538,7 @@ public abstract class AbstractJavadocMojo
             Set<String> exportedPackages = new HashSet<>();
             boolean exportAllPackages;
             ResolvePathResult resolvedPath = getResolvePathResult( javadocModule.getArtifactFile() );
-            if ( resolvedPath != null && resolvedPath.getModuleNameSource() == ModuleNameSource.MODULEDESCRIPTOR
-                && !isTest() )
+            if ( resolvedPath != null && resolvedPath.getModuleNameSource() == ModuleNameSource.MODULEDESCRIPTOR )
             {
                 Set<JavaModuleDescriptor.JavaExports> exports = resolvedPath.getModuleDescriptor().exports();
                 if ( exports.isEmpty() )
@@ -5176,7 +5175,6 @@ public abstract class AbstractJavadocMojo
         }
 
         if ( supportModulePath
-             && !isTest()
              && ( isAggregator()
                   || ModuleNameSource.MODULEDESCRIPTOR.equals( mainModuleNameSource )
                   || ModuleNameSource.MANIFEST.equals( mainModuleNameSource ) ) )