Merge pull request #35 from CoreMedia/MJAVADOC-620
[MJAVADOC-620] Do not ignore JARs w/o module info when building classpath
diff --git a/src/it/projects/MJAVADOC-620_no-dot-in-version/invoker.properties b/src/it/projects/MJAVADOC-620_no-dot-in-version/invoker.properties
new file mode 100644
index 0000000..3063815
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_no-dot-in-version/invoker.properties
@@ -0,0 +1,20 @@
+# 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.1 = -f maven-MJAVADOC620-jar install
+
+invoker.goals.2 = javadoc:aggregate
diff --git a/src/it/projects/MJAVADOC-620_no-dot-in-version/maven-MJAVADOC620-jar/pom.xml b/src/it/projects/MJAVADOC-620_no-dot-in-version/maven-MJAVADOC620-jar/pom.xml
new file mode 100644
index 0000000..6e87c00
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_no-dot-in-version/maven-MJAVADOC620-jar/pom.xml
@@ -0,0 +1,27 @@
+<!--
+ 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.maven-javadoc-plugin.it</groupId>
+ <artifactId>maven-MJAVADOC620-jar</artifactId>
+ <version>1-SNAPSHOT</version>
+ <packaging>jar</packaging>
+</project>
diff --git a/src/it/projects/MJAVADOC-620_no-dot-in-version/maven-MJAVADOC620-jar/src/main/java/somepackage/Test.java b/src/it/projects/MJAVADOC-620_no-dot-in-version/maven-MJAVADOC620-jar/src/main/java/somepackage/Test.java
new file mode 100644
index 0000000..18cb6fc
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_no-dot-in-version/maven-MJAVADOC620-jar/src/main/java/somepackage/Test.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package somepackage;
+
+/**
+ * Sample top-level class that is packaged into a non-module JAR.
+ */
+public class Test
+{
+}
diff --git a/src/it/projects/MJAVADOC-620_no-dot-in-version/pom.xml b/src/it/projects/MJAVADOC-620_no-dot-in-version/pom.xml
new file mode 100644
index 0000000..f857e76
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_no-dot-in-version/pom.xml
@@ -0,0 +1,52 @@
+<!--
+ 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.maven-javadoc-plugin.it</groupId>
+ <artifactId>maven-MJAVADOC-620-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>Maven MJAVADOC-620 Test</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>maven-MJAVADOC620-jar</artifactId>
+ <version>1-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-620_no-dot-in-version/src/main/java/TestUsage.java b/src/it/projects/MJAVADOC-620_no-dot-in-version/src/main/java/TestUsage.java
new file mode 100644
index 0000000..e0a79b1
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_no-dot-in-version/src/main/java/TestUsage.java
@@ -0,0 +1,34 @@
+/*
+ * 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 somepackage.Test;
+
+/**
+ * Sample class that tries to use top-level class from a non-module JAR.
+ */
+public class TestUsage
+{
+ /**
+ * Sample method that uses the top-level Test class from the other project.
+ */
+ public Test getTest()
+ {
+ return new Test();
+ }
+}
diff --git a/src/it/projects/MJAVADOC-620_no-dot-in-version/verify.bsh b/src/it/projects/MJAVADOC-620_no-dot-in-version/verify.bsh
new file mode 100644
index 0000000..bd4c872
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_no-dot-in-version/verify.bsh
@@ -0,0 +1,63 @@
+
+/*
+ * 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 java.io.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+ File target = new File( basedir, "target" );
+ if ( !target.exists() || !target.isDirectory() )
+ {
+ System.err.println( "target file is missing or not a directory." );
+ return false;
+ }
+
+ File apidocs = new File( basedir, "target/site/apidocs" );
+ if ( !apidocs.exists() || !apidocs.isDirectory() )
+ {
+ System.err.println( "target/site/apidocs file is missing or not a directory." );
+ return false;
+ }
+
+ File options = new File( apidocs, "options" );
+ if ( !options.exists() || !options.isFile() )
+ {
+ System.err.println( "target/site/apidocs/options file is missing or not a file." );
+ return false;
+ }
+
+ String str = FileUtils.fileRead( options );
+
+ if ( !str.contains( "maven-MJAVADOC620-jar-1-SNAPSHOT.jar" ) )
+ {
+ System.err.println( "Javadoc doesn't use correct artifacts." );
+ return false;
+ }
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+return result;
diff --git a/src/it/projects/MJAVADOC-620_top-level-package/invoker.properties b/src/it/projects/MJAVADOC-620_top-level-package/invoker.properties
new file mode 100644
index 0000000..3063815
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_top-level-package/invoker.properties
@@ -0,0 +1,20 @@
+# 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.1 = -f maven-MJAVADOC620-jar install
+
+invoker.goals.2 = javadoc:aggregate
diff --git a/src/it/projects/MJAVADOC-620_top-level-package/maven-MJAVADOC620-jar/pom.xml b/src/it/projects/MJAVADOC-620_top-level-package/maven-MJAVADOC620-jar/pom.xml
new file mode 100644
index 0000000..0036617
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_top-level-package/maven-MJAVADOC620-jar/pom.xml
@@ -0,0 +1,27 @@
+<!--
+ 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.maven-javadoc-plugin.it</groupId>
+ <artifactId>maven-MJAVADOC620-jar</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+</project>
diff --git a/src/it/projects/MJAVADOC-620_top-level-package/maven-MJAVADOC620-jar/src/main/java/Test.java b/src/it/projects/MJAVADOC-620_top-level-package/maven-MJAVADOC620-jar/src/main/java/Test.java
new file mode 100644
index 0000000..287d6c3
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_top-level-package/maven-MJAVADOC620-jar/src/main/java/Test.java
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+/**
+ * Sample top-level class that is packaged into a non-module JAR.
+ */
+public class Test
+{
+}
diff --git a/src/it/projects/MJAVADOC-620_top-level-package/pom.xml b/src/it/projects/MJAVADOC-620_top-level-package/pom.xml
new file mode 100644
index 0000000..fc405dd
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_top-level-package/pom.xml
@@ -0,0 +1,52 @@
+<!--
+ 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.maven-javadoc-plugin.it</groupId>
+ <artifactId>maven-MJAVADOC-620-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>Maven MJAVADOC-620 Test</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>maven-MJAVADOC620-jar</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-620_top-level-package/src/main/java/TestUsage.java b/src/it/projects/MJAVADOC-620_top-level-package/src/main/java/TestUsage.java
new file mode 100644
index 0000000..f7c5383
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_top-level-package/src/main/java/TestUsage.java
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+/**
+ * Sample class that tries to use top-level class from a non-module JAR.
+ */
+public class TestUsage
+{
+ /**
+ * Sample method that uses the top-level Test class from the other project.
+ */
+ public Test getTest()
+ {
+ return new Test();
+ }
+}
diff --git a/src/it/projects/MJAVADOC-620_top-level-package/verify.bsh b/src/it/projects/MJAVADOC-620_top-level-package/verify.bsh
new file mode 100644
index 0000000..ec34b19
--- /dev/null
+++ b/src/it/projects/MJAVADOC-620_top-level-package/verify.bsh
@@ -0,0 +1,63 @@
+
+/*
+ * 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 java.io.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+ File target = new File( basedir, "target" );
+ if ( !target.exists() || !target.isDirectory() )
+ {
+ System.err.println( "target file is missing or not a directory." );
+ return false;
+ }
+
+ File apidocs = new File( basedir, "target/site/apidocs" );
+ if ( !apidocs.exists() || !apidocs.isDirectory() )
+ {
+ System.err.println( "target/site/apidocs file is missing or not a directory." );
+ return false;
+ }
+
+ File options = new File( apidocs, "options" );
+ if ( !options.exists() || !options.isFile() )
+ {
+ System.err.println( "target/site/apidocs/options file is missing or not a file." );
+ return false;
+ }
+
+ String str = FileUtils.fileRead( options );
+
+ if ( !str.contains( "maven-MJAVADOC620-jar-1.0-SNAPSHOT.jar" ) )
+ {
+ System.err.println( "Javadoc doesn't use correct artifacts." );
+ return false;
+ }
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+return result;
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 9250cd0..7e31c15 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -5170,6 +5170,18 @@
}
}
+ /* MJAVADOC-620: also add all JARs where module-name-guessing leads to a FindException: */
+ for ( Entry<File, Exception> pathExceptionEntry : result.getPathExceptions().entrySet() )
+ {
+ Exception exception = pathExceptionEntry.getValue();
+ // For Java < 9 compatibility, reference FindException by name:
+ if ( "java.lang.module.FindException".equals( exception.getClass().getName() ) )
+ {
+ File jarPath = pathExceptionEntry.getKey();
+ classPathElements.add( jarPath );
+ }
+ }
+
String classpath = StringUtils.join( classPathElements.iterator(), File.pathSeparator );
addArgIfNotEmpty( arguments, "--class-path", JavadocUtil.quotedPathArgument( classpath ), false,
false );