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/25 20:39:12 UTC
[maven-javadoc-plugin] 01/01: [MJAVADOC-571] javadoc:aggregate
triggers Javadoc error for test-only modules
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MJAVADOC-571
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
commit deb3b00b62bc7aefc24c3dce7833d4d9a1fef0b1
Author: rfscholte <rf...@apache.org>
AuthorDate: Sun Apr 25 22:38:48 2021 +0200
[MJAVADOC-571] javadoc:aggregate triggers Javadoc error for test-only modules
---
.../invoker.properties | 18 +++++++
.../module1/pom.xml | 33 +++++++++++++
.../module1/src/main/java/module-info.java | 22 +++++++++
.../module1/src/main/java/module1/Module1.java | 28 +++++++++++
.../module2/pom.xml | 40 ++++++++++++++++
.../module2/src/test/java/module-info.java | 24 ++++++++++
.../module2/src/test/java/module2/Module2.java | 30 ++++++++++++
.../MJAVADOC-571_aggr-empty-sourcepaths/pom.xml | 55 ++++++++++++++++++++++
.../maven/plugins/javadoc/AbstractJavadocMojo.java | 18 +++++--
9 files changed, 263 insertions(+), 5 deletions(-)
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/invoker.properties b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/invoker.properties
new file mode 100644
index 0000000..bb26d97
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/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 = package javadoc:aggregate
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/pom.xml b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/pom.xml
new file mode 100644
index 0000000..113ae91
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/pom.xml
@@ -0,0 +1,33 @@
+<?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>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>mjavadoc571</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>module1</artifactId>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/src/main/java/module-info.java b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/src/main/java/module-info.java
new file mode 100644
index 0000000..75e8858
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/src/main/java/module-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+module module1
+{
+ exports module1 to module2;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/src/main/java/module1/Module1.java b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/src/main/java/module1/Module1.java
new file mode 100644
index 0000000..daeae13
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module1/src/main/java/module1/Module1.java
@@ -0,0 +1,28 @@
+package module1;
+
+/*
+ * 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.
+ */
+
+public final class Module1
+{
+ public String getName()
+ {
+ return null;
+ }
+}
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/pom.xml b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/pom.xml
new file mode 100644
index 0000000..99efcfb
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/pom.xml
@@ -0,0 +1,40 @@
+<?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>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>mjavadoc571</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>module2</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>module1</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/src/test/java/module-info.java b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/src/test/java/module-info.java
new file mode 100644
index 0000000..6b33913
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/src/test/java/module-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+module module2
+{
+ requires module1;
+
+ exports module2;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/src/test/java/module2/Module2.java b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/src/test/java/module2/Module2.java
new file mode 100644
index 0000000..b541b42
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/module2/src/test/java/module2/Module2.java
@@ -0,0 +1,30 @@
+package module2;
+
+/*
+ * 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 module1.Module1;
+
+public final class Module2
+{
+ public Module1 createModule1()
+ {
+ return null;
+ }
+}
diff --git a/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/pom.xml b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/pom.xml
new file mode 100644
index 0000000..0e09784
--- /dev/null
+++ b/src/it/projects/MJAVADOC-571_aggr-empty-sourcepaths/pom.xml
@@ -0,0 +1,55 @@
+<?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>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>mjavadoc571</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>module1</module>
+ <module>module2</module>
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.release>11</maven.compiler.release>
+ </properties>
+</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 7f75eb8..2625251 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -2381,9 +2381,13 @@ public abstract class AbstractJavadocMojo
additionalSourcePaths.addAll( l );
}
}
- mappedSourcePaths.put( ArtifactUtils.versionlessKey( subProject.getGroupId(),
- subProject.getArtifactId() ),
- additionalSourcePaths );
+
+ if ( !additionalSourcePaths.isEmpty() )
+ {
+ mappedSourcePaths.put( ArtifactUtils.versionlessKey( subProject.getGroupId(),
+ subProject.getArtifactId() ),
+ additionalSourcePaths );
+ }
}
}
}
@@ -2399,8 +2403,12 @@ public abstract class AbstractJavadocMojo
getJavadocDirectory().getAbsolutePath() ) );
sourcePaths.addAll( l );
}
- mappedSourcePaths.put( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ),
- sourcePaths );
+
+ if ( !sourcePaths.isEmpty() )
+ {
+ mappedSourcePaths.put( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ),
+ sourcePaths );
+ }
}
return mappedSourcePaths;