[MJAVADOC-537] warning when javadoc is invoked for dependency
Explicitly set the batchMode to true
diff --git a/Jenkinsfile b/Jenkinsfile
index 8a16e4c..e9f05f7 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -17,4 +17,4 @@
* under the License.
*/
-asfMavenTlpPlgnBuild(jdk:['7','8','9'])
+asfMavenTlpPlgnBuild()
diff --git a/pom.xml b/pom.xml
index 1b75dd4..43011e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
- <version>32</version>
+ <version>33</version>
<relativePath>../../pom/maven/maven-plugins/pom.xml</relativePath>
</parent>
@@ -113,6 +113,9 @@
<contributor>
<name>Anton Klarén</name>
</contributor>
+ <contributor>
+ <name>Kevin Risden</name>
+ </contributor>
</contributors>
<dependencies>
@@ -234,7 +237,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-java</artifactId>
- <version>0.9.8</version>
+ <version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -296,7 +299,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>2.12.0</version>
+ <version>2.23.4</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -326,6 +329,7 @@
<!-- Checksum files cannot contain a license header -->
<exclude>**/*.sha1</exclude>
<!-- Javadoc package list files cannot contain a license header -->
+ <exclude>**/*element-list*</exclude>
<exclude>**/*package-list*</exclude>
<!-- This file is used to patch the generated Javadoc html files -->
<exclude>src/main/resources/org/apache/maven/plugins/javadoc/frame-injection-fix.txt</exclude>
@@ -340,31 +344,6 @@
</pluginManagement>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-bytecode-version</id>
- <configuration>
- <rules>
- <enforceBytecodeVersion>
- <ignoreClasses>
- <ignoreClass>module-info</ignoreClass>
- </ignoreClasses>
- </enforceBytecodeVersion>
- </rules>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>extra-enforcer-rules</artifactId>
- <version>1.0-beta-6</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<executions>
@@ -441,6 +420,8 @@
</filterProperties>
<environmentVariables>
<JENKINS_MAVEN_AGENT_DISABLED>true</JENKINS_MAVEN_AGENT_DISABLED>
+ <!-- required for MJAVADOC-538 -->
+ <_JAVA_OPTIONS>-Dabc=def</_JAVA_OPTIONS>
</environmentVariables>
</configuration>
</plugin>
diff --git a/src/it/projects/MJAVADOC-257/invoker.properties b/src/it/projects/MJAVADOC-257/invoker.properties
index 08d1d7b..12cb573 100644
--- a/src/it/projects/MJAVADOC-257/invoker.properties
+++ b/src/it/projects/MJAVADOC-257/invoker.properties
@@ -16,3 +16,5 @@
# under the License.
invoker.goals=clean site
+# there are no new doclettags for plugin-tools
+invoker.java.version=10-
diff --git a/src/it/projects/MJAVADOC-427/verify.groovy b/src/it/projects/MJAVADOC-427/verify.groovy
index 8e3c9ab..035c4d6 100644
--- a/src/it/projects/MJAVADOC-427/verify.groovy
+++ b/src/it/projects/MJAVADOC-427/verify.groovy
@@ -23,4 +23,4 @@
// assert that javadoc of class correctly contains link, just like method details
assert file.text =~ /Link to slf4j <a href=".*?".*?><code>LoggerFactory<\/code><\/a>/
-assert file.text =~ /<pre>public.*?<a href=".*?".*?>LoggerFactory<\/a>.*?getLoggerFactory.*?\(\)<\/pre>/
+assert file.text =~ /<pre[^<]*>public.*?<a href=".*?".*?>LoggerFactory<\/a>.*?getLoggerFactory.*?\(\)<\/pre>/
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/invoker.properties b/src/it/projects/MJAVADOC-449_aggr_modulepath/invoker.properties
new file mode 100644
index 0000000..fb9625f
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/invoker.properties
@@ -0,0 +1,19 @@
+# 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 = 9+
+invoker.goals=javadoc:aggregate
+
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/pom.xml b/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/pom.xml
new file mode 100644
index 0000000..aa6921b
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/pom.xml
@@ -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. -->
+
+<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>modulea</groupId>
+ <artifactId>modulea</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <release>9</release>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/src/main/java/com/javamodularity/modulea/HelloWorld.java b/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/src/main/java/com/javamodularity/modulea/HelloWorld.java
new file mode 100644
index 0000000..26447fc
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/src/main/java/com/javamodularity/modulea/HelloWorld.java
@@ -0,0 +1,37 @@
+package com.javamodularity.modulea;
+
+/*
+ * 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.
+ */
+
+/**
+ * <p>Javadoc aggregation from module a.</p>
+ */
+public class HelloWorld {
+
+ /**
+ * <p>method f does something</p>
+ */
+ public void f() {
+ }
+
+ public static void main(String... args) {
+ System.out.println("Hello Modular World!");
+ }
+
+}
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/src/main/java/module-info.java b/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/src/main/java/module-info.java
new file mode 100644
index 0000000..f716447
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/modulea/src/main/java/module-info.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.
+ */
+
+/**
+ * <p>modulea does something</p>
+ */
+module modulea {
+ exports com.javamodularity.modulea;
+}
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/pom.xml b/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/pom.xml
new file mode 100644
index 0000000..c4a7557
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/pom.xml
@@ -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. -->
+
+<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>moduleb</groupId>
+ <artifactId>moduleb</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <release>9</release>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/src/main/java/com/javamodularity/moduleb/HelloWorld.java b/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/src/main/java/com/javamodularity/moduleb/HelloWorld.java
new file mode 100644
index 0000000..4d9f4d2
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/src/main/java/com/javamodularity/moduleb/HelloWorld.java
@@ -0,0 +1,37 @@
+package com.javamodularity.moduleb;
+
+/*
+ * 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.
+ */
+
+/**
+ * <p>Javadoc aggregation from module a.</p>
+ */
+public class HelloWorld {
+
+ /**
+ * <p>method f does something</p>
+ */
+ public void f() {
+ }
+
+ public static void main(String... args) {
+ System.out.println("Hello Modular World!");
+ }
+
+}
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/src/main/java/module-info.java b/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/src/main/java/module-info.java
new file mode 100644
index 0000000..bcf2890
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/moduleb/src/main/java/module-info.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.
+ */
+
+/**
+ * <p>moduleb does something</p>
+ */
+module moduleb {
+ exports com.javamodularity.moduleb;
+}
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/pom.xml b/src/it/projects/MJAVADOC-449_aggr_modulepath/pom.xml
new file mode 100644
index 0000000..d77f74d
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/pom.xml
@@ -0,0 +1,35 @@
+<?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>parent</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>modulea</module>
+ <module>moduleb</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MJAVADOC-449_aggr_modulepath/verify.groovy b/src/it/projects/MJAVADOC-449_aggr_modulepath/verify.groovy
new file mode 100644
index 0000000..28fdb1f
--- /dev/null
+++ b/src/it/projects/MJAVADOC-449_aggr_modulepath/verify.groovy
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+int javaVersion = System.getProperty( "java.specification.version" ) as Integer
+if ( javaVersion >= 11 ) {
+ def index = new File( basedir, 'target/site/apidocs/index.html')
+
+ assert index.text =~ /<a href="modulea\/module-summary\.html">modulea<\/a>/
+ assert index.text =~ /<a href="moduleb\/module-summary\.html">moduleb<\/a>/
+
+ assert new File( basedir, 'target/site/apidocs/modulea/module-summary.html').exists()
+ assert new File( basedir, 'target/site/apidocs/moduleb/module-summary.html').exists()
+}
+else {
+ def overview = new File( basedir, 'target/site/apidocs/overview-summary.html')
+
+ assert overview.text =~ /<a href="modulea-summary.html">modulea<\/a>/
+ assert overview.text =~ /<a href="moduleb-summary.html">moduleb<\/a>/
+
+ assert new File( basedir, 'target/site/apidocs/modulea-summary.html').exists()
+ assert new File( basedir, 'target/site/apidocs/moduleb-summary.html').exists()
+}
diff --git a/src/it/projects/MJAVADOC-497/verify.bsh b/src/it/projects/MJAVADOC-497/verify.bsh
index 8f23e77..d90f357 100644
--- a/src/it/projects/MJAVADOC-497/verify.bsh
+++ b/src/it/projects/MJAVADOC-497/verify.bsh
@@ -21,14 +21,25 @@
try
{
- File packageList = new File( basedir, "target/site/apidocs/package-list" );
- if ( !packageList.exists() )
+ File list;
+
+ String javaVersion = System.getProperty( "java.specification.version" );
+ if ( javaVersion.startsWith( "1." ) || javaVersion.equals( "9" ) )
+ {
+ list = new File( basedir, "target/site/apidocs/package-list" );
+ }
+ else
+ {
+ list = new File( basedir, "target/site/apidocs/element-list" );
+ }
+
+ if ( !list.exists() )
{
System.err.println( packageList + " is missing" );
return false;
}
- FileReader fr = new FileReader( packageList );
+ FileReader fr = new FileReader( list );
BufferedReader br = new BufferedReader( fr );
String line = br.readLine();
if ( !"com.example.foo".equals( line ) || br.readLine() != null )
diff --git a/src/it/projects/MJAVADOC-506_excl-module-info/pom.xml b/src/it/projects/MJAVADOC-506_excl-module-info/pom.xml
new file mode 100644
index 0000000..b2472ae
--- /dev/null
+++ b/src/it/projects/MJAVADOC-506_excl-module-info/pom.xml
@@ -0,0 +1,76 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>mjavadoc506</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <url>https://issues.apache.org/jira/browse/MJAVADOC-506</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.6</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <excludes>
+ <exclude>module-info.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <sourceFileExcludes>
+ <exclude>module-info.java</exclude>
+ </sourceFileExcludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/projects/MJAVADOC-506_excl-module-info/src/main/java/com/foo/MyClass.java b/src/it/projects/MJAVADOC-506_excl-module-info/src/main/java/com/foo/MyClass.java
new file mode 100644
index 0000000..7370ac0
--- /dev/null
+++ b/src/it/projects/MJAVADOC-506_excl-module-info/src/main/java/com/foo/MyClass.java
@@ -0,0 +1,25 @@
+package com.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.
+ */
+
+public class MyClass
+{
+
+}
diff --git a/src/it/projects/MJAVADOC-506_excl-module-info/src/main/java/module-info.java b/src/it/projects/MJAVADOC-506_excl-module-info/src/main/java/module-info.java
new file mode 100644
index 0000000..45f7f3d
--- /dev/null
+++ b/src/it/projects/MJAVADOC-506_excl-module-info/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 M.N {
+ requires org.apache.commons.lang3;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-506_excl-module-info/verify.groovy b/src/it/projects/MJAVADOC-506_excl-module-info/verify.groovy
new file mode 100644
index 0000000..3a870ed
--- /dev/null
+++ b/src/it/projects/MJAVADOC-506_excl-module-info/verify.groovy
@@ -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.
+ */
+
+def javaVersion = System.getProperty( "java.specification.version" )
+if ( javaVersion =~ /(1\..+)|9|10/ ) {
+ assert new File( basedir, 'target/apidocs/com/foo/MyClass.html').exists()
+} else {
+ assert new File( basedir, 'target/apidocs/M.N/com/foo/MyClass.html').exists()
+}
+
+
diff --git a/src/it/projects/MJAVADOC-538/invoker.properties b/src/it/projects/MJAVADOC-538/invoker.properties
new file mode 100644
index 0000000..a4e250d
--- /dev/null
+++ b/src/it/projects/MJAVADOC-538/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=clean javadoc:javadoc
diff --git a/src/it/projects/MJAVADOC-538/pom.xml b/src/it/projects/MJAVADOC-538/pom.xml
new file mode 100644
index 0000000..ecac918
--- /dev/null
+++ b/src/it/projects/MJAVADOC-538/pom.xml
@@ -0,0 +1,71 @@
+<?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.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc-538</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <url>https://issues.apache.org/jira/browse/MJAVADOC-538</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <failOnWarnings>true</failOnWarnings>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <activation>
+ <jdk>10</jdk>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <additionalOptions>
+ <option>-html4</option>
+ </additionalOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/src/it/projects/MJAVADOC-538/src/main/java/foo/bar/MyClass.java b/src/it/projects/MJAVADOC-538/src/main/java/foo/bar/MyClass.java
new file mode 100644
index 0000000..e5960e3
--- /dev/null
+++ b/src/it/projects/MJAVADOC-538/src/main/java/foo/bar/MyClass.java
@@ -0,0 +1,24 @@
+package foo.bar;
+
+/*
+ * 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 class MyClass
+{
+}
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
index 1036095..f2439d6 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
@@ -57,7 +57,6 @@
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.WriterFactory;
import java.io.BufferedReader;
import java.io.File;
@@ -65,7 +64,6 @@
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
-import java.io.Writer;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
@@ -392,7 +390,7 @@
/**
* Split {@link #fixTags} by comma.
*
- * @see {@link #init()}
+ * @see #init()
*/
private String[] fixTagsSplitted;
@@ -1145,10 +1143,8 @@
* @param stringWriter not null
* @param originalContent not null
* @param entity not null
- * @param changeDetected
- * @return the updated changeDetected flag
* @throws IOException if any
- * @see #extractOriginalJavadoc(String, AbstractJavaEntity)
+ * @see #extractOriginalJavadoc
*/
private void takeCareSingleComment( final StringWriter stringWriter, final String originalContent,
final JavaAnnotatedElement entity )
@@ -1262,9 +1258,9 @@
* <font color="#000000">DummyClass </font><font color="#000000">{}</font></code>
* </code>
*
- * @param buffer not null
- * @param javaClass not null
- * @param indent not null
+ * @param stringWriter not null
+ * @param javaClass not null
+ * @param indent not null
* @see #getDefaultClassJavadocComment(JavaClass)
* @see #appendDefaultAuthorTag(StringBuilder, String)
* @see #appendDefaultSinceTag(StringBuilder, String)
@@ -1417,7 +1413,7 @@
}
else
{
- sb.append( value.toString().substring( 0, 39 ) ).append( "\"{trunked}" );
+ sb.append( value.toString(), 0, 39 ).append( "\"{trunked}" );
}
// CHECKSTYLE_ON: MagicNumber
}
@@ -1496,11 +1492,11 @@
* <font color="#000000">){}</font>
* </code>
*
- * @param buffer not null
+ * @param stringWriter not null
* @param javaExecutable not null
- * @param indent not null
+ * @param indent not null
* @throws MojoExecutionException if any
- * @see #getDefaultMethodJavadocComment(JavaMethod)
+ * @see #getDefaultMethodJavadocComment
* @see #appendDefaultSinceTag(StringBuilder, String)
*/
private void addDefaultMethodComment( final StringWriter stringWriter, final JavaExecutable javaExecutable,
@@ -1576,7 +1572,6 @@
* @param originalContent not null
* @param entity not null
* @param indent not null
- * @param changeDetected
* @return the updated changeDetected flag
* @throws MojoExecutionException if any
* @throws IOException if any
@@ -1805,7 +1800,7 @@
while ( linktagMatcher.find() )
{
int startName = linktagMatcher.end();
- resolvedComment.append( comment.substring( startIndex, startName ) );
+ resolvedComment.append( comment, startIndex, startName );
int endName = comment.indexOf( "}", startName );
if ( endName >= 0 )
{
@@ -1949,21 +1944,20 @@
}
String paramName = params.get( 0 );
- if ( docletTag.getName().equals( PARAM_TAG ) )
+ switch ( docletTag.getName() )
{
- javaEntityTags.putJavadocParamTag( paramName, originalJavadocTag );
- }
- else if ( docletTag.getName().equals( RETURN_TAG ) )
- {
- javaEntityTags.setJavadocReturnTag( originalJavadocTag );
- }
- else if ( docletTag.getName().equals( THROWS_TAG ) )
- {
- javaEntityTags.putJavadocThrowsTag( paramName, originalJavadocTag );
- }
- else
- {
- javaEntityTags.getUnknownTags().add( originalJavadocTag );
+ case PARAM_TAG:
+ javaEntityTags.putJavadocParamTag( paramName, originalJavadocTag );
+ break;
+ case RETURN_TAG:
+ javaEntityTags.setJavadocReturnTag( originalJavadocTag );
+ break;
+ case THROWS_TAG:
+ javaEntityTags.putJavadocThrowsTag( paramName, originalJavadocTag );
+ break;
+ default:
+ javaEntityTags.getUnknownTags().add( originalJavadocTag );
+ break;
}
}
else
@@ -2190,14 +2184,14 @@
if ( clazz != null )
{
- if ( ClassUtils.isAssignable( clazz, RuntimeException.class ) )
+ if ( RuntimeException.class.isAssignableFrom( clazz ) )
{
sb.append( StringUtils.replace( originalJavadocTag, exceptionClassName, clazz.getName() ) );
// added qualified name
javaEntityTags.putJavadocThrowsTag( clazz.getName(), originalJavadocTag );
}
- else if ( ClassUtils.isAssignable( clazz, Throwable.class ) )
+ else if ( Throwable.class.isAssignableFrom( clazz ) )
{
getLog().debug( "Removing '" + originalJavadocTag + "'; Throwable not specified by "
+ getJavaMethodAsString( javaExecutable ) + " and it is not a RuntimeException." );
@@ -2789,7 +2783,7 @@
* @param javaMethod the QDox JavaMethod object not null
* @return <code>true</code> if <code>javaMethod</code> exists in the given <code>clazz</code>,
* <code>false</code> otherwise.
- * @see #isInherited(JavaMethod)
+ * @see #isInherited(JavaExecutable)
*/
private boolean isInherited( Class<?> clazz, JavaExecutable javaMethod )
{
@@ -2945,8 +2939,8 @@
* @param className not null
* @return the Class corresponding to the given class name using the project classloader.
* @throws MojoExecutionException if class not found
- * @see {@link ClassUtils#getClass(ClassLoader, String, boolean)}
- * @see {@link #getProjectClassLoader()}
+ * @see ClassUtils#getClass(ClassLoader, String, boolean)
+ * @see #getProjectClassLoader()
*/
private Class<?> getClass( String className )
throws MojoExecutionException
@@ -3036,18 +3030,8 @@
private static void writeFile( final File javaFile, final String encoding, final String content )
throws IOException
{
- Writer writer = null;
- try
- {
- writer = WriterFactory.newWriter( javaFile, encoding );
- writer.write( StringUtils.unifyLineSeparators( content ) );
- writer.close();
- writer = null;
- }
- finally
- {
- IOUtil.close( writer );
- }
+ String unified = StringUtils.unifyLineSeparators( content );
+ FileUtils.fileWrite( javaFile, encoding, unified );
}
/**
@@ -3625,7 +3609,7 @@
}
String textTrimmed = text.trim();
- return text.substring( text.indexOf( textTrimmed ), text.length() );
+ return text.substring( text.indexOf( textTrimmed ) );
}
/**
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 e19b68f..4173940 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -98,12 +98,9 @@
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
@@ -247,6 +244,10 @@
* Default location for css
*/
private static final String RESOURCE_CSS_DIR = RESOURCE_DIR + "/css";
+
+ private static final String PACKAGE_LIST = "package-list";
+ private static final String ELEMENT_LIST = "element-list";
+
/**
* For Javadoc options appears since Java 1.4.
@@ -1748,6 +1749,8 @@
DEFAULT_JAVA_API_LINKS.put( "api_1.7", "https://docs.oracle.com/javase/7/docs/api/" );
DEFAULT_JAVA_API_LINKS.put( "api_1.8", "https://docs.oracle.com/javase/8/docs/api/" );
DEFAULT_JAVA_API_LINKS.put( "api_9", "https://docs.oracle.com/javase/9/docs/api/" );
+ DEFAULT_JAVA_API_LINKS.put( "api_10", "https://docs.oracle.com/javase/10/docs/api/" );
+ DEFAULT_JAVA_API_LINKS.put( "api_11", "https://docs.oracle.com/en/java/javase/11/docs/api" );
}
// ----------------------------------------------------------------------
@@ -1916,11 +1919,9 @@
protected final void verifyRemovedParameter( String paramName )
{
- Object pluginConfiguration = mojo.getConfiguration();
- if ( pluginConfiguration instanceof Xpp3Dom )
+ Xpp3Dom configDom = mojo.getConfiguration();
+ if ( configDom != null )
{
- Xpp3Dom configDom = (Xpp3Dom) pluginConfiguration;
-
if ( configDom.getChild( paramName ) != null )
{
throw new IllegalArgumentException( "parameter '" + paramName
@@ -1931,11 +1932,9 @@
private void verifyReplacedParameter( String oldParamName, String newParamNew )
{
- Object pluginConfiguration = mojo.getConfiguration();
- if ( pluginConfiguration instanceof Xpp3Dom )
+ Xpp3Dom configDom = mojo.getConfiguration();
+ if ( configDom != null )
{
- Xpp3Dom configDom = (Xpp3Dom) pluginConfiguration;
-
if ( configDom.getChild( oldParamName ) != null )
{
throw new IllegalArgumentException( "parameter '" + oldParamName
@@ -2391,12 +2390,7 @@
{
return resourceResolver.resolveDependencySourcePaths( config );
}
- catch ( final ArtifactResolutionException e )
- {
- throw new MavenReportException(
- "Failed to resolve one or more javadoc source/resource artifacts:\n\n" + e.getMessage(), e );
- }
- catch ( final ArtifactNotFoundException e )
+ catch ( final ArtifactResolutionException | ArtifactNotFoundException e )
{
throw new MavenReportException(
"Failed to resolve one or more javadoc source/resource artifacts:\n\n" + e.getMessage(), e );
@@ -2476,7 +2470,7 @@
String[] excludedPackages = getExcludedPackages();
String[] subpackagesList = subpackages.split( "[:]" );
- excludedNames = JavadocUtil.getExcludedNames( sourcePaths, subpackagesList, excludedPackages );
+ excludedNames = JavadocUtil.getExcludedNames( sourcePaths, excludedPackages );
}
String excludeArg = "";
@@ -2736,23 +2730,7 @@
tc = tcs.get( 0 );
}
}
- catch ( NoSuchMethodException e )
- {
- // ignore
- }
- catch ( SecurityException e )
- {
- // ignore
- }
- catch ( IllegalAccessException e )
- {
- // ignore
- }
- catch ( IllegalArgumentException e )
- {
- // ignore
- }
- catch ( InvocationTargetException e )
+ catch ( SecurityException | ReflectiveOperationException e )
{
// ignore
}
@@ -3739,25 +3717,7 @@
{
jVersion = JavadocUtil.getJavadocVersion( jExecutable );
}
- catch ( IOException e )
- {
- if ( getLog().isWarnEnabled() )
- {
- getLog().warn( "Unable to find the javadoc version: " + e.getMessage() );
- getLog().warn( "Using the Java version instead of, i.e. " + JAVA_VERSION );
- }
- jVersion = JAVA_VERSION;
- }
- catch ( CommandLineException e )
- {
- if ( getLog().isWarnEnabled() )
- {
- getLog().warn( "Unable to find the javadoc version: " + e.getMessage() );
- getLog().warn( "Using the Java version instead of, i.e. " + JAVA_VERSION );
- }
- jVersion = JAVA_VERSION;
- }
- catch ( IllegalArgumentException e )
+ catch ( IOException | CommandLineException | IllegalArgumentException e )
{
if ( getLog().isWarnEnabled() )
{
@@ -3825,8 +3785,8 @@
* @param b the flag which controls if the argument is added or not.
* @param value the argument value to be added.
* @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f
- * @see #addArgIf(java.util.List, boolean, String)
- * @see #isJavaDocVersionAtLeast(float)
+ * @see #addArgIf(List, boolean, String)
+ * @see #isJavaDocVersionAtLeast(JavaVersion)
*/
private void addArgIf( List<String> arguments, boolean b, String value, JavaVersion requiredJavaVersion )
{
@@ -3856,7 +3816,7 @@
* @param arguments a list of arguments, not null
* @param key the argument name.
* @param value the argument value to be added.
- * @see #addArgIfNotEmpty(java.util.List, String, String, boolean)
+ * @see #addArgIfNotEmpty(List, String, String, boolean)
*/
private void addArgIfNotEmpty( List<String> arguments, String key, String value )
{
@@ -3876,7 +3836,7 @@
* @param splitValue if <code>true</code> given value will be tokenized by comma
* @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f
* @see #addArgIfNotEmpty(List, String, String, boolean, boolean)
- * @see #isJavaDocVersionAtLeast(float)
+ * @see #isJavaDocVersionAtLeast(JavaVersion)
*/
private void addArgIfNotEmpty( List<String> arguments, String key, String value, boolean repeatKey,
boolean splitValue, JavaVersion requiredJavaVersion )
@@ -3969,7 +3929,7 @@
* @param key the argument name.
* @param value the argument value to be added.
* @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f
- * @see #addArgIfNotEmpty(java.util.List, String, String, float, boolean)
+ * @see #addArgIfNotEmpty(List, String, String, JavaVersion, boolean)
*/
private void addArgIfNotEmpty( List<String> arguments, String key, String value,
JavaVersion requiredJavaVersion )
@@ -3986,8 +3946,8 @@
* @param value the argument value to be added.
* @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f
* @param repeatKey repeat or not the key in the command line
- * @see #addArgIfNotEmpty(java.util.List, String, String)
- * @see #isJavaDocVersionAtLeast(float)
+ * @see #addArgIfNotEmpty(List, String, String)
+ * @see #isJavaDocVersionAtLeast
*/
private void addArgIfNotEmpty( List<String> arguments, String key, String value, JavaVersion requiredJavaVersion,
boolean repeatKey )
@@ -4315,7 +4275,7 @@
/**
* @param sourcePaths could be null
* @param files not null
- * @return a list files with unnamed package names for files in the sourecPaths
+ * @return a list files with unnamed package names for files in the sourcePaths
*/
private List<String> getFilesWithUnnamedPackages( Collection<String> sourcePaths, List<String> files )
{
@@ -4327,7 +4287,7 @@
* @param files not null, containing list of quoted files
* @param onlyPackageName boolean for only package name
* @return a list of package names or files with unnamed package names, depending the value of the unnamed flag
- * @see #getFiles(List)
+ * @see #getFiles
* @see #getSourcePaths()
*/
private List<String> getPackageNamesOrFilesWithUnnamedPackages( Collection<String> sourcePaths, List<String> files,
@@ -4405,7 +4365,7 @@
File optionsFile = new File( javadocOutputDirectory, OPTIONS_FILE_NAME );
StringBuilder options = new StringBuilder();
- options.append( StringUtils.join( arguments.toArray( new String[arguments.size()] ),
+ options.append( StringUtils.join( arguments.iterator(),
SystemUtils.LINE_SEPARATOR ) );
try
@@ -4435,7 +4395,7 @@
* @see <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.4.html#runningjavadoc">
* What s New in Javadoc 1.4
* </a>
- * @see #isJavaDocVersionAtLeast(float)
+ * @see #isJavaDocVersionAtLeast(JavaVersion)
* @see #ARGFILE_FILE_NAME
* @see #FILES_FILE_NAME
*/
@@ -4643,8 +4603,8 @@
* Standard Javadoc Options wrapped by this Plugin.
*
* @param javadocOutputDirectory not null
- * @param arguments not null
- * @param sourcePaths not null
+ * @param arguments not null
+ * @param allSourcePaths not null
* @throws MavenReportException if any
* @see <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#javadocoptions">http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#javadocoptions</a>
*/
@@ -4680,46 +4640,7 @@
{
addArgIf( arguments, breakiterator, "-breakiterator", SINCE_JAVADOC_1_5 );
}
-
- List<String> roots = getProjectSourceRoots( getProject() );
- File mainDescriptor = findMainDescriptor( roots );
-
- final LocationManager locationManager = new LocationManager();
-
- if ( mainDescriptor != null && !isTest() )
- {
- ResolvePathsRequest<File> request =
- ResolvePathsRequest.withFiles( getPathElements() ).setMainModuleDescriptor( mainDescriptor );
- try
- {
- ResolvePathsResult<File> result = locationManager.resolvePaths( request );
-
- String classpath = StringUtils.join( result.getClasspathElements().iterator(), File.pathSeparator );
- addArgIfNotEmpty( arguments, "--class-path", JavadocUtil.quotedPathArgument( classpath ) );
-
- Set<File> modulePathElements = new HashSet<>( result.getModulepathElements().keySet() ) ;
- if ( allSourcePaths.size() > 1 )
- {
- // Probably required due to bug in javadoc (Java 9+)
- modulePathElements.addAll( getProjectBuildOutputDirs( getProject() ) );
- }
-
- String modulepath =
- StringUtils.join( modulePathElements.iterator(), File.pathSeparator );
- addArgIfNotEmpty( arguments, "--module-path", JavadocUtil.quotedPathArgument( modulepath ) );
- }
- catch ( IOException e )
- {
- throw new MavenReportException( e.getMessage(), e );
- }
- }
- else
- {
- String classpath = StringUtils.join( getPathElements().iterator(), File.pathSeparator );
- addArgIfNotEmpty( arguments, "-classpath", JavadocUtil.quotedPathArgument( classpath ) );
- }
-
Collection<String> reactorKeys = new HashSet<>( session.getProjects().size() );
for ( MavenProject reactorProject : session.getProjects() )
{
@@ -4727,6 +4648,10 @@
reactorProject.getArtifactId() ) );
}
+ final LocationManager locationManager = new LocationManager();
+
+ Collection<String> additionalModules = new ArrayList<>();
+
Path moduleSourceDir = null;
if ( allSourcePaths.size() > 1 )
{
@@ -4748,6 +4673,8 @@
String moduleName =
locationManager.resolvePaths( request ).getMainModuleDescriptor().name();
+ additionalModules.add( moduleName );
+
addArgIfNotEmpty( arguments, "--patch-module", moduleName + '='
+ JavadocUtil.quotedPathArgument( getSourcePath( projectSourcepaths.getValue() ) ) );
@@ -4772,6 +4699,62 @@
}
}
}
+
+ List<String> roots = getProjectSourceRoots( getProject() );
+
+ File mainDescriptor = findMainDescriptor( roots );
+
+ if ( javadocRuntimeVersion.isAtLeast( "9" ) && ( isAggregator() || mainDescriptor != null ) && !isTest() )
+ {
+ ResolvePathsRequest<File> request =
+ ResolvePathsRequest.withFiles( getPathElements() ).setAdditionalModules( additionalModules );
+
+ if ( mainDescriptor != null )
+ {
+ request.setMainModuleDescriptor( mainDescriptor );
+ }
+
+ try
+ {
+ ResolvePathsResult<File> result = locationManager.resolvePaths( request );
+
+ Set<File> modulePathElements = new HashSet<>( result.getModulepathElements().keySet() ) ;
+ if ( allSourcePaths.size() > 1 )
+ {
+ // Probably required due to bug in javadoc (Java 9+)
+ modulePathElements.addAll( getProjectBuildOutputDirs( getProject() ) );
+ }
+
+ Collection<File> classPathElements = new ArrayList<>( result.getClasspathElements().size() );
+ for ( File file : result.getClasspathElements() )
+ {
+ if ( file.isDirectory() && new File( file, "module-info.class" ).exists() )
+ {
+ modulePathElements.add( file );
+ }
+ else
+ {
+ classPathElements.add( file );
+ }
+ }
+
+ String classpath = StringUtils.join( classPathElements.iterator(), File.pathSeparator );
+ addArgIfNotEmpty( arguments, "--class-path", JavadocUtil.quotedPathArgument( classpath ) );
+
+ String modulepath =
+ StringUtils.join( modulePathElements.iterator(), File.pathSeparator );
+ addArgIfNotEmpty( arguments, "--module-path", JavadocUtil.quotedPathArgument( modulepath ) );
+ }
+ catch ( IOException e )
+ {
+ throw new MavenReportException( e.getMessage(), e );
+ }
+ }
+ else
+ {
+ String classpath = StringUtils.join( getPathElements().iterator(), File.pathSeparator );
+ addArgIfNotEmpty( arguments, "-classpath", JavadocUtil.quotedPathArgument( classpath ) );
+ }
if ( StringUtils.isNotEmpty( doclet ) )
{
@@ -4834,10 +4817,7 @@
if ( additionalOptions != null && additionalOptions.length > 0 )
{
- for ( String option : additionalOptions )
- {
- arguments.add( option );
- }
+ Collections.addAll( arguments, additionalOptions );
}
}
@@ -5251,8 +5231,8 @@
writeDebugJavadocScript( cmdLine, javadocOutputDirectory );
}
- CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
- CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
+ CommandLineUtils.StringStreamConsumer err = new JavadocUtil.JavadocOutputStreamConsumer();
+ CommandLineUtils.StringStreamConsumer out = new JavadocUtil.JavadocOutputStreamConsumer();
try
{
int exitCode = CommandLineUtils.executeCommandLine( cmd, out, err );
@@ -5679,7 +5659,7 @@
* @return the detected Javadoc links using the Maven conventions for all dependencies defined in the current
* project or an empty list.
* @see #detectLinks
- * @see #isValidJavadocLink(String)
+ * @see #isValidJavadocLink
* @since 2.6
*/
private List<String> getDependenciesLinks()
@@ -5800,34 +5780,32 @@
return null;
}
- File javaApiPackageListFile = new File( getJavadocOptionsFile().getParentFile(), "package-list" );
+ final Path javaApiListFile;
+ final String resourceName;
+ if ( JavaVersion.parse( apiVersion ).isAtLeast( "10" ) )
+ {
+ javaApiListFile = getJavadocOptionsFile().getParentFile().toPath().resolve( "element-list" );
+ resourceName = "java-api-element-list-" + apiVersion;
+ }
+ else
+ {
+ javaApiListFile = getJavadocOptionsFile().getParentFile().toPath().resolve( "package-list" );
+ resourceName = "java-api-package-list-" + apiVersion;
+ }
OfflineLink link = new OfflineLink();
- link.setLocation( javaApiPackageListFile.getParentFile().getAbsolutePath() );
+ link.setLocation( javaApiListFile.getParent().toAbsolutePath().toString() );
link.setUrl( javaApiLink );
- InputStream in = null;
- OutputStream out = null;
- try
+ try ( InputStream in = this.getClass().getResourceAsStream( resourceName ) )
{
- in = this.getClass().getResourceAsStream( "java-api-package-list-" + apiVersion );
- out = new FileOutputStream( javaApiPackageListFile );
- IOUtil.copy( in, out );
- out.close();
- out = null;
- in.close();
- in = null;
+ Files.copy( in, javaApiListFile );
}
catch ( IOException ioe )
{
logError( "Can't get java-api-package-list-" + apiVersion + ": " + ioe.getMessage(), ioe );
return null;
}
- finally
- {
- IOUtil.close( in );
- IOUtil.close( out );
- }
return link;
}
@@ -5870,12 +5848,15 @@
{
try
{
- URI linkUri;
+ final URI packageListUri;
+ final URI elementListUri;
+
if ( link.trim().toLowerCase( Locale.ENGLISH ).startsWith( "http:" ) || link.trim().toLowerCase(
Locale.ENGLISH ).startsWith( "https:" ) || link.trim().toLowerCase( Locale.ENGLISH ).startsWith(
"ftp:" ) || link.trim().toLowerCase( Locale.ENGLISH ).startsWith( "file:" ) )
{
- linkUri = new URI( link + "/package-list" );
+ packageListUri = new URI( link + '/' + PACKAGE_LIST );
+ elementListUri = new URI( link + '/' + ELEMENT_LIST );
}
else
{
@@ -5896,27 +5877,44 @@
getLog().error( "The given File link: " + dir + " is not a dir." );
}
}
- linkUri = new File( dir, "package-list" ).toURI();
+ packageListUri = new File( dir, PACKAGE_LIST ).toURI();
+ elementListUri = new File( dir, ELEMENT_LIST ).toURI();
}
- if ( !JavadocUtil.isValidPackageList( linkUri.toURL(), settings, validateLinks ) )
+
+ IOException elementListIOException = null;
+ try
{
- if ( getLog().isErrorEnabled() )
+ if ( JavadocUtil.isValidElementList( elementListUri.toURL(), settings, validateLinks ) )
{
- if ( detecting )
- {
- getLog().warn( "Invalid link: " + link + "/package-list. Ignored it." );
- }
- else
- {
- getLog().error( "Invalid link: " + link + "/package-list. Ignored it." );
- }
+ return true;
}
-
- return false;
+ }
+ catch ( IOException e )
+ {
+ elementListIOException = e;
+ }
+
+ if ( JavadocUtil.isValidPackageList( packageListUri.toURL(), settings, validateLinks ) )
+ {
+ return true;
}
- return true;
+ if ( getLog().isErrorEnabled() )
+ {
+ if ( detecting )
+ {
+ getLog().warn( "Invalid links: "
+ + link + " with /" + PACKAGE_LIST + " or / " + ELEMENT_LIST + ". Ignored it." );
+ }
+ else
+ {
+ getLog().error( "Invalid links: "
+ + link + " with /" + PACKAGE_LIST + " or / " + ELEMENT_LIST + ". Ignored it." );
+ }
+ }
+
+ return false;
}
catch ( URISyntaxException e )
{
@@ -5924,11 +5922,11 @@
{
if ( detecting )
{
- getLog().warn( "Malformed link: " + link + "/package-list. Ignored it." );
+ getLog().warn( "Malformed link: " + e.getInput() + ". Ignored it." );
}
else
{
- getLog().error( "Malformed link: " + link + "/package-list. Ignored it." );
+ getLog().error( "Malformed link: " + e.getInput() + ". Ignored it." );
}
}
return false;
@@ -5939,11 +5937,11 @@
{
if ( detecting )
{
- getLog().warn( "Error fetching link: " + link + "/package-list. Ignored it." );
+ getLog().warn( "Error fetching link: " + link + ". Ignored it." );
}
else
{
- getLog().error( "Error fetching link: " + link + "/package-list. Ignored it." );
+ getLog().error( "Error fetching link: " + link + ". Ignored it." );
}
}
return false;
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
index 3060678..c343a58 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
@@ -269,14 +269,13 @@
archiver.setArchiver( jarArchiver );
archiver.setOutputFile( javadocJar );
- File contentDirectory = javadocFiles;
- if ( !contentDirectory.exists() )
+ if ( !javadocFiles.exists() )
{
getLog().warn( "JAR will be empty - no content was marked for inclusion!" );
}
else
{
- archiver.getArchiver().addDirectory( contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
+ archiver.getArchiver().addDirectory( javadocFiles, DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
}
List<Resource> resources = project.getBuild().getResources();
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
index dab71d8..4fba34f 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
@@ -133,15 +133,7 @@
{
executeReport( locale );
}
- catch ( MavenReportException e )
- {
- if ( failOnError )
- {
- throw e;
- }
- getLog().error( "Error while creating javadoc report: " + e.getMessage(), e );
- }
- catch ( RuntimeException e )
+ catch ( MavenReportException | RuntimeException e )
{
if ( failOnError )
{
@@ -234,7 +226,7 @@
{
boolean canGenerate = false;
- if ( !this.isAggregator() || ( this.isAggregator() && this.project.isExecutionRoot() ) )
+ if ( !this.isAggregator() || this.project.isExecutionRoot() )
{
Collection<String> sourcePaths;
List<String> files;
@@ -289,7 +281,7 @@
}
/**
- * @param theDestDir The destiation directory.
+ * @param theDestDir The destination directory.
*/
public void setDestDir( String theDestDir )
{
@@ -328,11 +320,7 @@
Locale locale = Locale.getDefault();
generate( sink, locale );
}
- catch ( MavenReportException e )
- {
- failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation", e );
- }
- catch ( RuntimeException e )
+ catch ( MavenReportException | RuntimeException e )
{
failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation", e );
}
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
index ea7e6fb..22cab64 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -62,16 +62,13 @@
import org.codehaus.plexus.util.cli.Commandline;
import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
-import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Modifier;
@@ -79,6 +76,8 @@
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -111,7 +110,7 @@
/** Error message when VM could not be started using invoker. */
protected static final String ERROR_INIT_VM =
"Error occurred during initialization of VM, try to reduce the Java heap size for the MAVEN_OPTS "
- + "environnement variable using -Xms:<size> and -Xmx:<size>.";
+ + "environment variable using -Xms:<size> and -Xmx:<size>.";
/**
* Method that removes the invalid directories in the specified directories. <b>Note</b>: All elements in
@@ -193,21 +192,16 @@
* Method that gets all the source files to be excluded from the javadoc on the given source paths.
*
* @param sourcePaths the path to the source files
- * @param subpackagesList list of subpackages to be included in the javadoc
* @param excludedPackages the package names to be excluded in the javadoc
* @return a List of the source files to be excluded in the generated javadoc
*/
- protected static List<String> getExcludedNames( Collection<String> sourcePaths, String[] subpackagesList,
- String[] excludedPackages )
+ protected static List<String> getExcludedNames( Collection<String> sourcePaths, String[] excludedPackages )
{
List<String> excludedNames = new ArrayList<>();
for ( String path : sourcePaths )
{
- for ( String aSubpackagesList : subpackagesList )
- {
- List<String> excludes = getExcludedPackages( path, excludedPackages );
- excludedNames.addAll( excludes );
- }
+ List<String> excludes = getExcludedPackages( path, excludedPackages );
+ excludedNames.addAll( excludes );
}
return excludedNames;
@@ -295,8 +289,7 @@
return;
}
- List<String> excludes = new ArrayList<>();
- excludes.addAll( Arrays.asList( FileUtils.getDefaultExcludes() ) );
+ List<String> excludes = new ArrayList<>( Arrays.asList( FileUtils.getDefaultExcludes() ) );
if ( StringUtils.isNotEmpty( excludedocfilessubdir ) )
{
@@ -697,24 +690,14 @@
return false;
}
- OutputStream ost = new ByteArrayOutputStream();
- OutputStreamWriter osw = null;
try
{
- osw = new OutputStreamWriter( ost, charsetName );
- osw.close();
- osw = null;
+ return Charset.isSupported( charsetName );
}
- catch ( IOException exc )
+ catch ( IllegalCharsetNameException e )
{
return false;
}
- finally
- {
- IOUtil.close( osw );
- }
-
- return true;
}
/**
@@ -828,36 +811,7 @@
throw new IOException( "The url could not be null." );
}
- if ( !file.getParentFile().exists() )
- {
- file.getParentFile().mkdirs();
- }
-
- InputStream in = null;
- OutputStream out = null;
- try
- {
- in = url.openStream();
-
- if ( in == null )
- {
- throw new IOException( "The resource " + url + " doesn't exists." );
- }
-
- out = new FileOutputStream( file );
-
- IOUtil.copy( in, out );
-
- out.close();
- out = null;
- in.close();
- in = null;
- }
- finally
- {
- IOUtil.close( in );
- IOUtil.close( out );
- }
+ FileUtils.copyURLToFile( url, file );
}
/**
@@ -1081,12 +1035,8 @@
}
List<String> classes = new ArrayList<>();
- JarInputStream jarStream = null;
-
- try
+ try ( JarInputStream jarStream = new JarInputStream( new FileInputStream( jarFile ) ) )
{
- jarStream = new JarInputStream( new FileInputStream( jarFile ) );
-
for ( JarEntry jarEntry = jarStream.getNextJarEntry(); jarEntry != null; jarEntry =
jarStream.getNextJarEntry() )
{
@@ -1099,13 +1049,6 @@
jarStream.closeEntry();
}
-
- jarStream.close();
- jarStream = null;
- }
- finally
- {
- IOUtil.close( jarStream );
}
return classes;
@@ -1502,7 +1445,7 @@
* @author Robert Scholte
* @since 3.0.1
*/
- private static class JavadocOutputStreamConsumer
+ protected static class JavadocOutputStreamConsumer
extends CommandLineUtils.StringStreamConsumer
{
@Override
@@ -1690,45 +1633,8 @@
throw new IllegalArgumentException( "The url is null" );
}
- BufferedReader reader = null;
- HttpGet httpMethod = null;
- HttpClient httpClient = null;
-
- try
+ try ( BufferedReader reader = getReader( url, settings ) )
{
- if ( "file".equals( url.getProtocol() ) )
- {
- // Intentionally using the platform default encoding here since this is what Javadoc uses internally.
- reader = new BufferedReader( new InputStreamReader( url.openStream() ) );
- }
- else
- {
- // http, https...
- httpClient = createHttpClient( settings, url );
-
- httpMethod = new HttpGet( url.toString() );
- HttpResponse response;
- try
- {
- response = httpClient.execute( httpMethod );
- }
- catch ( SocketTimeoutException e )
- {
- // could be a sporadic failure, one more retry before we give up
- response = httpClient.execute( httpMethod );
- }
-
- int status = response.getStatusLine().getStatusCode();
- if ( status != HttpStatus.SC_OK )
- {
- throw new FileNotFoundException( "Unexpected HTTP status code " + status + " getting resource "
- + url.toExternalForm() + "." );
- }
-
- // Intentionally using the platform default encoding here since this is what Javadoc uses internally.
- reader = new BufferedReader( new InputStreamReader( response.getEntity().getContent() ) );
- }
-
if ( validateContent )
{
for ( String line = reader.readLine(); line != null; line = reader.readLine() )
@@ -1739,25 +1645,95 @@
}
}
}
-
- reader.close();
- reader = null;
-
return true;
}
- finally
+ }
+
+ protected static boolean isValidElementList( URL url, Settings settings, boolean validateContent )
+ throws IOException
+ {
+ if ( url == null )
{
- IOUtil.close( reader );
-
- if ( httpMethod != null )
- {
- httpMethod.releaseConnection();
- }
- if ( httpClient != null )
- {
- httpClient.getConnectionManager().shutdown();
- }
+ throw new IllegalArgumentException( "The url is null" );
}
+
+ try ( BufferedReader reader = getReader( url, settings ) )
+ {
+ if ( validateContent )
+ {
+ for ( String line = reader.readLine(); line != null; line = reader.readLine() )
+ {
+ if ( line.startsWith( "module:" ) )
+ {
+ continue;
+ }
+
+ if ( !isValidPackageName( line ) )
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ }
+
+ private static BufferedReader getReader( URL url, Settings settings ) throws IOException
+ {
+ BufferedReader reader = null;
+
+ if ( "file".equals( url.getProtocol() ) )
+ {
+ // Intentionally using the platform default encoding here since this is what Javadoc uses internally.
+ reader = new BufferedReader( new InputStreamReader( url.openStream() ) );
+ }
+ else
+ {
+ // http, https...
+ final HttpClient httpClient = createHttpClient( settings, url );
+
+ final HttpGet httpMethod = new HttpGet( url.toString() );
+
+ HttpResponse response;
+ try
+ {
+ response = httpClient.execute( httpMethod );
+ }
+ catch ( SocketTimeoutException e )
+ {
+ // could be a sporadic failure, one more retry before we give up
+ response = httpClient.execute( httpMethod );
+ }
+
+ int status = response.getStatusLine().getStatusCode();
+ if ( status != HttpStatus.SC_OK )
+ {
+ throw new FileNotFoundException( "Unexpected HTTP status code " + status + " getting resource "
+ + url.toExternalForm() + "." );
+ }
+
+ // Intentionally using the platform default encoding here since this is what Javadoc uses internally.
+ reader = new BufferedReader( new InputStreamReader( response.getEntity().getContent() ) )
+ {
+ @Override
+ public void close()
+ throws IOException
+ {
+ super.close();
+
+ if ( httpMethod != null )
+ {
+ httpMethod.releaseConnection();
+ }
+ if ( httpClient != null )
+ {
+ httpClient.getConnectionManager().shutdown();
+ }
+ }
+ };
+ }
+
+ return reader;
}
private static boolean isValidPackageName( String str )
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java
index 2c13cba..89b9e73 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java
@@ -130,12 +130,7 @@
archiver.setDestFile( bundleFile );
archiver.createArchive();
}
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Failed to assemble javadoc-resources bundle archive. Reason: "
- + e.getMessage(), e );
- }
- catch ( IOException e )
+ catch ( ArchiverException | IOException e )
{
throw new MojoExecutionException( "Failed to assemble javadoc-resources bundle archive. Reason: "
+ e.getMessage(), e );
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 b4d331f..f028e24 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
@@ -227,9 +227,7 @@
{
IOException error =
new IOException( "Failed to read javadoc options from: " + optionsFile + "\nReason: "
- + e.getMessage() );
- error.initCause( e );
-
+ + e.getMessage(), e );
throw error;
}
finally
@@ -279,21 +277,14 @@
dirs.add( entry.getValue() );
}
}
- catch ( ArtifactResolutionException e )
+ catch ( ArtifactResolutionException | ArtifactNotFoundException e )
{
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( e.getMessage(), e );
}
}
- catch ( ArtifactNotFoundException e )
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( e.getMessage(), e );
- }
- }
-
+
List<JavadocBundle> result = new ArrayList<>();
for ( String d : dirs )
@@ -311,9 +302,7 @@
}
catch ( XmlPullParserException e )
{
- IOException error = new IOException( "Failed to parse javadoc options: " + e.getMessage() );
- error.initCause( e );
-
+ IOException error = new IOException( "Failed to parse javadoc options: " + e.getMessage(), e );
throw error;
}
}
@@ -432,8 +421,7 @@
unArchiver.extract();
- result.add( new AbstractMap.SimpleEntry<String, String>( a.getDependencyConflictId(),
- d.getAbsolutePath() ) );
+ result.add( new AbstractMap.SimpleEntry<>( a.getDependencyConflictId(), d.getAbsolutePath() ) );
}
catch ( final NoSuchArchiverException e )
{
@@ -466,19 +454,13 @@
if ( config.includeCompileSources() )
{
final List<String> srcRoots = reactorProject.getCompileSourceRoots();
- for ( final String root : srcRoots )
- {
- dirs.add( root );
- }
+ dirs.addAll( srcRoots );
}
if ( config.includeTestSources() )
{
final List<String> srcRoots = reactorProject.getTestCompileSourceRoots();
- for ( final String root : srcRoots )
- {
- dirs.add( root );
- }
+ dirs.addAll( srcRoots );
}
}
diff --git a/src/main/resources/javadoc-report_es.properties b/src/main/resources/javadoc-report_es.properties
new file mode 100644
index 0000000..75b402f
--- /dev/null
+++ b/src/main/resources/javadoc-report_es.properties
@@ -0,0 +1,19 @@
+# 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.
+
+report.javadoc.name=Javadoc
+report.javadoc.description=Documentaci\u00F3n de API Javadoc.
diff --git a/src/main/resources/org/apache/maven/plugins/javadoc/java-api-element-list-10 b/src/main/resources/org/apache/maven/plugins/javadoc/java-api-element-list-10
new file mode 100644
index 0000000..8c46f3d
--- /dev/null
+++ b/src/main/resources/org/apache/maven/plugins/javadoc/java-api-element-list-10
@@ -0,0 +1,391 @@
+module:java.activation
+javax.activation
+module:java.base
+java.io
+java.lang
+java.lang.annotation
+java.lang.invoke
+java.lang.module
+java.lang.ref
+java.lang.reflect
+java.math
+java.net
+java.net.spi
+java.nio
+java.nio.channels
+java.nio.channels.spi
+java.nio.charset
+java.nio.charset.spi
+java.nio.file
+java.nio.file.attribute
+java.nio.file.spi
+java.security
+java.security.acl
+java.security.cert
+java.security.interfaces
+java.security.spec
+java.text
+java.text.spi
+java.time
+java.time.chrono
+java.time.format
+java.time.temporal
+java.time.zone
+java.util
+java.util.concurrent
+java.util.concurrent.atomic
+java.util.concurrent.locks
+java.util.function
+java.util.jar
+java.util.regex
+java.util.spi
+java.util.stream
+java.util.zip
+javax.crypto
+javax.crypto.interfaces
+javax.crypto.spec
+javax.net
+javax.net.ssl
+javax.security.auth
+javax.security.auth.callback
+javax.security.auth.login
+javax.security.auth.spi
+javax.security.auth.x500
+javax.security.cert
+module:java.compiler
+javax.annotation.processing
+javax.lang.model
+javax.lang.model.element
+javax.lang.model.type
+javax.lang.model.util
+javax.tools
+module:java.corba
+javax.activity
+javax.rmi
+javax.rmi.CORBA
+org.omg.CORBA
+org.omg.CORBA_2_3
+org.omg.CORBA_2_3.portable
+org.omg.CORBA.DynAnyPackage
+org.omg.CORBA.ORBPackage
+org.omg.CORBA.portable
+org.omg.CORBA.TypeCodePackage
+org.omg.CosNaming
+org.omg.CosNaming.NamingContextExtPackage
+org.omg.CosNaming.NamingContextPackage
+org.omg.Dynamic
+org.omg.DynamicAny
+org.omg.DynamicAny.DynAnyFactoryPackage
+org.omg.DynamicAny.DynAnyPackage
+org.omg.IOP
+org.omg.IOP.CodecFactoryPackage
+org.omg.IOP.CodecPackage
+org.omg.Messaging
+org.omg.PortableInterceptor
+org.omg.PortableInterceptor.ORBInitInfoPackage
+org.omg.PortableServer
+org.omg.PortableServer.CurrentPackage
+org.omg.PortableServer.POAManagerPackage
+org.omg.PortableServer.POAPackage
+org.omg.PortableServer.portable
+org.omg.PortableServer.ServantLocatorPackage
+org.omg.SendingContext
+org.omg.stub.java.rmi
+module:java.datatransfer
+java.awt.datatransfer
+module:java.desktop
+java.applet
+java.awt
+java.awt.color
+java.awt.desktop
+java.awt.dnd
+java.awt.event
+java.awt.font
+java.awt.geom
+java.awt.im
+java.awt.im.spi
+java.awt.image
+java.awt.image.renderable
+java.awt.print
+java.beans
+java.beans.beancontext
+javax.accessibility
+javax.imageio
+javax.imageio.event
+javax.imageio.metadata
+javax.imageio.plugins.bmp
+javax.imageio.plugins.jpeg
+javax.imageio.plugins.tiff
+javax.imageio.spi
+javax.imageio.stream
+javax.print
+javax.print.attribute
+javax.print.attribute.standard
+javax.print.event
+javax.sound.midi
+javax.sound.midi.spi
+javax.sound.sampled
+javax.sound.sampled.spi
+javax.swing
+javax.swing.border
+javax.swing.colorchooser
+javax.swing.event
+javax.swing.filechooser
+javax.swing.plaf
+javax.swing.plaf.basic
+javax.swing.plaf.metal
+javax.swing.plaf.multi
+javax.swing.plaf.nimbus
+javax.swing.plaf.synth
+javax.swing.table
+javax.swing.text
+javax.swing.text.html
+javax.swing.text.html.parser
+javax.swing.text.rtf
+javax.swing.tree
+javax.swing.undo
+module:java.instrument
+java.lang.instrument
+module:java.jnlp
+javax.jnlp
+module:java.logging
+java.util.logging
+module:java.management
+java.lang.management
+javax.management
+javax.management.loading
+javax.management.modelmbean
+javax.management.monitor
+javax.management.openmbean
+javax.management.relation
+javax.management.remote
+javax.management.timer
+module:java.management.rmi
+javax.management.remote.rmi
+module:java.naming
+javax.naming
+javax.naming.directory
+javax.naming.event
+javax.naming.ldap
+javax.naming.spi
+module:java.prefs
+java.util.prefs
+module:java.rmi
+java.rmi
+java.rmi.activation
+java.rmi.dgc
+java.rmi.registry
+java.rmi.server
+javax.rmi.ssl
+module:java.scripting
+javax.script
+module:java.se
+module:java.se.ee
+module:java.security.jgss
+javax.security.auth.kerberos
+org.ietf.jgss
+module:java.security.sasl
+javax.security.sasl
+module:java.smartcardio
+javax.smartcardio
+module:java.sql
+java.sql
+javax.sql
+javax.transaction.xa
+module:java.sql.rowset
+javax.sql.rowset
+javax.sql.rowset.serial
+javax.sql.rowset.spi
+module:java.transaction
+javax.transaction
+module:java.xml
+javax.xml
+javax.xml.catalog
+javax.xml.datatype
+javax.xml.namespace
+javax.xml.parsers
+javax.xml.stream
+javax.xml.stream.events
+javax.xml.stream.util
+javax.xml.transform
+javax.xml.transform.dom
+javax.xml.transform.sax
+javax.xml.transform.stax
+javax.xml.transform.stream
+javax.xml.validation
+javax.xml.xpath
+org.w3c.dom
+org.w3c.dom.bootstrap
+org.w3c.dom.events
+org.w3c.dom.ls
+org.w3c.dom.ranges
+org.w3c.dom.traversal
+org.w3c.dom.views
+org.xml.sax
+org.xml.sax.ext
+org.xml.sax.helpers
+module:java.xml.bind
+javax.xml.bind
+javax.xml.bind.annotation
+javax.xml.bind.annotation.adapters
+javax.xml.bind.attachment
+javax.xml.bind.helpers
+javax.xml.bind.util
+module:java.xml.crypto
+javax.xml.crypto
+javax.xml.crypto.dom
+javax.xml.crypto.dsig
+javax.xml.crypto.dsig.dom
+javax.xml.crypto.dsig.keyinfo
+javax.xml.crypto.dsig.spec
+module:java.xml.ws
+javax.jws
+javax.jws.soap
+javax.xml.soap
+javax.xml.ws
+javax.xml.ws.handler
+javax.xml.ws.handler.soap
+javax.xml.ws.http
+javax.xml.ws.soap
+javax.xml.ws.spi
+javax.xml.ws.spi.http
+javax.xml.ws.wsaddressing
+module:java.xml.ws.annotation
+javax.annotation
+module:javafx.base
+javafx.beans
+javafx.beans.binding
+javafx.beans.property
+javafx.beans.property.adapter
+javafx.beans.value
+javafx.collections
+javafx.collections.transformation
+javafx.event
+javafx.util
+javafx.util.converter
+module:javafx.controls
+javafx.scene.chart
+javafx.scene.control
+javafx.scene.control.cell
+javafx.scene.control.skin
+module:javafx.fxml
+javafx.fxml
+module:javafx.graphics
+javafx.animation
+javafx.application
+javafx.concurrent
+javafx.css
+javafx.css.converter
+javafx.geometry
+javafx.print
+javafx.scene
+javafx.scene.canvas
+javafx.scene.effect
+javafx.scene.image
+javafx.scene.input
+javafx.scene.layout
+javafx.scene.paint
+javafx.scene.shape
+javafx.scene.text
+javafx.scene.transform
+javafx.stage
+module:javafx.media
+javafx.scene.media
+module:javafx.swing
+javafx.embed.swing
+module:javafx.web
+javafx.scene.web
+module:jdk.accessibility
+com.sun.java.accessibility.util
+module:jdk.attach
+com.sun.tools.attach
+com.sun.tools.attach.spi
+module:jdk.charsets
+module:jdk.compiler
+com.sun.source.doctree
+com.sun.source.tree
+com.sun.source.util
+com.sun.tools.javac
+module:jdk.crypto.cryptoki
+module:jdk.crypto.ec
+module:jdk.dynalink
+jdk.dynalink
+jdk.dynalink.beans
+jdk.dynalink.linker
+jdk.dynalink.linker.support
+jdk.dynalink.support
+module:jdk.editpad
+module:jdk.hotspot.agent
+module:jdk.httpserver
+com.sun.net.httpserver
+com.sun.net.httpserver.spi
+module:jdk.incubator.httpclient
+jdk.incubator.http
+module:jdk.jartool
+com.sun.jarsigner
+jdk.security.jarsigner
+module:jdk.javadoc
+com.sun.javadoc
+com.sun.tools.javadoc
+jdk.javadoc.doclet
+module:jdk.jcmd
+module:jdk.jconsole
+com.sun.tools.jconsole
+module:jdk.jdeps
+module:jdk.jdi
+com.sun.jdi
+com.sun.jdi.connect
+com.sun.jdi.connect.spi
+com.sun.jdi.event
+com.sun.jdi.request
+module:jdk.jdwp.agent
+module:jdk.jfr
+jdk.jfr
+jdk.jfr.consumer
+module:jdk.jlink
+module:jdk.jshell
+jdk.jshell
+jdk.jshell.execution
+jdk.jshell.spi
+jdk.jshell.tool
+module:jdk.jsobject
+netscape.javascript
+module:jdk.jstatd
+module:jdk.localedata
+module:jdk.management
+com.sun.management
+module:jdk.management.agent
+module:jdk.management.cmm
+jdk.management.cmm
+module:jdk.management.jfr
+jdk.management.jfr
+module:jdk.management.resource
+jdk.management.resource
+module:jdk.naming.dns
+module:jdk.naming.rmi
+module:jdk.net
+jdk.net
+module:jdk.pack
+module:jdk.packager.services
+jdk.packager.services
+jdk.packager.services.singleton
+module:jdk.rmic
+module:jdk.scripting.nashorn
+jdk.nashorn.api.scripting
+jdk.nashorn.api.tree
+module:jdk.sctp
+com.sun.nio.sctp
+module:jdk.security.auth
+com.sun.security.auth
+com.sun.security.auth.callback
+com.sun.security.auth.login
+com.sun.security.auth.module
+module:jdk.security.jgss
+com.sun.security.jgss
+module:jdk.snmp
+module:jdk.xml.dom
+org.w3c.dom.css
+org.w3c.dom.html
+org.w3c.dom.stylesheets
+org.w3c.dom.xpath
+module:jdk.zipfs
\ No newline at end of file
diff --git a/src/main/resources/org/apache/maven/plugins/javadoc/java-api-element-list-11 b/src/main/resources/org/apache/maven/plugins/javadoc/java-api-element-list-11
new file mode 100644
index 0000000..bfb4f01
--- /dev/null
+++ b/src/main/resources/org/apache/maven/plugins/javadoc/java-api-element-list-11
@@ -0,0 +1,282 @@
+module:java.base
+java.io
+java.lang
+java.lang.annotation
+java.lang.invoke
+java.lang.module
+java.lang.ref
+java.lang.reflect
+java.math
+java.net
+java.net.spi
+java.nio
+java.nio.channels
+java.nio.channels.spi
+java.nio.charset
+java.nio.charset.spi
+java.nio.file
+java.nio.file.attribute
+java.nio.file.spi
+java.security
+java.security.acl
+java.security.cert
+java.security.interfaces
+java.security.spec
+java.text
+java.text.spi
+java.time
+java.time.chrono
+java.time.format
+java.time.temporal
+java.time.zone
+java.util
+java.util.concurrent
+java.util.concurrent.atomic
+java.util.concurrent.locks
+java.util.function
+java.util.jar
+java.util.regex
+java.util.spi
+java.util.stream
+java.util.zip
+javax.crypto
+javax.crypto.interfaces
+javax.crypto.spec
+javax.net
+javax.net.ssl
+javax.security.auth
+javax.security.auth.callback
+javax.security.auth.login
+javax.security.auth.spi
+javax.security.auth.x500
+javax.security.cert
+module:java.compiler
+javax.annotation.processing
+javax.lang.model
+javax.lang.model.element
+javax.lang.model.type
+javax.lang.model.util
+javax.tools
+module:java.datatransfer
+java.awt.datatransfer
+module:java.desktop
+java.applet
+java.awt
+java.awt.color
+java.awt.desktop
+java.awt.dnd
+java.awt.event
+java.awt.font
+java.awt.geom
+java.awt.im
+java.awt.im.spi
+java.awt.image
+java.awt.image.renderable
+java.awt.print
+java.beans
+java.beans.beancontext
+javax.accessibility
+javax.imageio
+javax.imageio.event
+javax.imageio.metadata
+javax.imageio.plugins.bmp
+javax.imageio.plugins.jpeg
+javax.imageio.plugins.tiff
+javax.imageio.spi
+javax.imageio.stream
+javax.print
+javax.print.attribute
+javax.print.attribute.standard
+javax.print.event
+javax.sound.midi
+javax.sound.midi.spi
+javax.sound.sampled
+javax.sound.sampled.spi
+javax.swing
+javax.swing.border
+javax.swing.colorchooser
+javax.swing.event
+javax.swing.filechooser
+javax.swing.plaf
+javax.swing.plaf.basic
+javax.swing.plaf.metal
+javax.swing.plaf.multi
+javax.swing.plaf.nimbus
+javax.swing.plaf.synth
+javax.swing.table
+javax.swing.text
+javax.swing.text.html
+javax.swing.text.html.parser
+javax.swing.text.rtf
+javax.swing.tree
+javax.swing.undo
+module:java.instrument
+java.lang.instrument
+module:java.logging
+java.util.logging
+module:java.management
+java.lang.management
+javax.management
+javax.management.loading
+javax.management.modelmbean
+javax.management.monitor
+javax.management.openmbean
+javax.management.relation
+javax.management.remote
+javax.management.timer
+module:java.management.rmi
+javax.management.remote.rmi
+module:java.naming
+javax.naming
+javax.naming.directory
+javax.naming.event
+javax.naming.ldap
+javax.naming.spi
+module:java.net.http
+java.net.http
+module:java.prefs
+java.util.prefs
+module:java.rmi
+java.rmi
+java.rmi.activation
+java.rmi.dgc
+java.rmi.registry
+java.rmi.server
+javax.rmi.ssl
+module:java.scripting
+javax.script
+module:java.se
+module:java.security.jgss
+javax.security.auth.kerberos
+org.ietf.jgss
+module:java.security.sasl
+javax.security.sasl
+module:java.smartcardio
+javax.smartcardio
+module:java.sql
+java.sql
+javax.sql
+module:java.sql.rowset
+javax.sql.rowset
+javax.sql.rowset.serial
+javax.sql.rowset.spi
+module:java.transaction.xa
+javax.transaction.xa
+module:java.xml
+javax.xml
+javax.xml.catalog
+javax.xml.datatype
+javax.xml.namespace
+javax.xml.parsers
+javax.xml.stream
+javax.xml.stream.events
+javax.xml.stream.util
+javax.xml.transform
+javax.xml.transform.dom
+javax.xml.transform.sax
+javax.xml.transform.stax
+javax.xml.transform.stream
+javax.xml.validation
+javax.xml.xpath
+org.w3c.dom
+org.w3c.dom.bootstrap
+org.w3c.dom.events
+org.w3c.dom.ls
+org.w3c.dom.ranges
+org.w3c.dom.traversal
+org.w3c.dom.views
+org.xml.sax
+org.xml.sax.ext
+org.xml.sax.helpers
+module:java.xml.crypto
+javax.xml.crypto
+javax.xml.crypto.dom
+javax.xml.crypto.dsig
+javax.xml.crypto.dsig.dom
+javax.xml.crypto.dsig.keyinfo
+javax.xml.crypto.dsig.spec
+module:jdk.accessibility
+com.sun.java.accessibility.util
+module:jdk.attach
+com.sun.tools.attach
+com.sun.tools.attach.spi
+module:jdk.charsets
+module:jdk.compiler
+com.sun.source.doctree
+com.sun.source.tree
+com.sun.source.util
+com.sun.tools.javac
+module:jdk.crypto.cryptoki
+module:jdk.crypto.ec
+module:jdk.dynalink
+jdk.dynalink
+jdk.dynalink.beans
+jdk.dynalink.linker
+jdk.dynalink.linker.support
+jdk.dynalink.support
+module:jdk.editpad
+module:jdk.hotspot.agent
+module:jdk.httpserver
+com.sun.net.httpserver
+com.sun.net.httpserver.spi
+module:jdk.jartool
+com.sun.jarsigner
+jdk.security.jarsigner
+module:jdk.javadoc
+com.sun.javadoc
+com.sun.tools.javadoc
+jdk.javadoc.doclet
+module:jdk.jcmd
+module:jdk.jconsole
+com.sun.tools.jconsole
+module:jdk.jdeps
+module:jdk.jdi
+com.sun.jdi
+com.sun.jdi.connect
+com.sun.jdi.connect.spi
+com.sun.jdi.event
+com.sun.jdi.request
+module:jdk.jdwp.agent
+module:jdk.jfr
+jdk.jfr
+jdk.jfr.consumer
+module:jdk.jlink
+module:jdk.jshell
+jdk.jshell
+jdk.jshell.execution
+jdk.jshell.spi
+jdk.jshell.tool
+module:jdk.jsobject
+netscape.javascript
+module:jdk.jstatd
+module:jdk.localedata
+module:jdk.management
+com.sun.management
+module:jdk.management.agent
+module:jdk.management.jfr
+jdk.management.jfr
+module:jdk.naming.dns
+module:jdk.naming.rmi
+module:jdk.net
+jdk.net
+jdk.nio
+module:jdk.pack
+module:jdk.rmic
+module:jdk.scripting.nashorn
+jdk.nashorn.api.scripting
+jdk.nashorn.api.tree
+module:jdk.sctp
+com.sun.nio.sctp
+module:jdk.security.auth
+com.sun.security.auth
+com.sun.security.auth.callback
+com.sun.security.auth.login
+com.sun.security.auth.module
+module:jdk.security.jgss
+com.sun.security.jgss
+module:jdk.xml.dom
+org.w3c.dom.css
+org.w3c.dom.html
+org.w3c.dom.stylesheets
+org.w3c.dom.xpath
+module:jdk.zipfs
\ No newline at end of file
diff --git a/src/main/resources/test-javadoc-report_es.properties b/src/main/resources/test-javadoc-report_es.properties
new file mode 100644
index 0000000..a726495
--- /dev/null
+++ b/src/main/resources/test-javadoc-report_es.properties
@@ -0,0 +1,19 @@
+# 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.
+
+report.test-javadoc.name=Javadoc de Pruebas
+report.test-javadoc.description=Documentaci\u00F3n de API Javadoc para Pruebas.
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java
index 706b26e..1bfad67 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java
@@ -31,6 +31,7 @@
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.languages.java.version.JavaVersion;
import org.codehaus.plexus.util.FileUtils;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
@@ -231,7 +232,16 @@
File apidocs = new File( getBasedir(), "target/test/unit/aggregate-resources-test/target/site/apidocs" );
// Test overview
- File overviewSummary = new File( apidocs, "overview-summary.html" );
+ File overviewSummary;
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) )
+ {
+ overviewSummary = new File( apidocs, "overview-summary.html" );
+ }
+ else
+ {
+ overviewSummary = new File( apidocs, "index.html" );
+ }
+
assertTrue( overviewSummary.exists() );
String overview = readFile( overviewSummary ).toLowerCase();
assertTrue( overview.contains( "<a href=\"resources/test/package-summary.html\">resources.test</a>" ) );
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java b/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
index c530ef2..94ad8f8 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
@@ -721,18 +721,7 @@
private static String readFile( File file )
throws Exception
{
- Reader fileReader = null;
- try
- {
- fileReader = ReaderFactory.newReader( file, "UTF-8" );
- final String content = IOUtil.toString( fileReader );
- fileReader.close();
- fileReader = null;
- return content;
- }
- finally
- {
- IOUtil.close( fileReader );
- }
+ String content = FileUtils.fileRead( file, "UTF-8" );
+ return content;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
index 18e71cc..16d7a4e 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
@@ -112,7 +112,11 @@
assertTrue( set.contains( "javadocjar/def/package-use.html" ) );
assertTrue( set.contains( "javadocjar/def/package-tree.html" ) );
assertTrue( set.contains( "javadocjar/def/package-summary.html" ) );
- assertTrue( set.contains( "javadocjar/def/package-frame.html" ) );
+ // package frame not generated anymore since Java 11
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) )
+ {
+ assertTrue( set.contains( "javadocjar/def/package-frame.html" ) );
+ }
assertTrue( set.contains( "javadocjar/def/class-use/AppSample.html" ) );
assertTrue( set.contains( "index.html" ) );
assertTrue( set.contains( "javadocjar/def/App.html" ) );
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
index f21e063..0f18b6b 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
@@ -22,13 +22,12 @@
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
-import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,8 +47,6 @@
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.languages.java.version.JavaVersion;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
@@ -193,21 +190,12 @@
private static String readFile( File file )
throws IOException
{
- String strTmp;
StringBuilder str = new StringBuilder( (int) file.length() );
- BufferedReader in = new BufferedReader( new FileReader( file ) );
- try
+ for ( String strTmp : Files.readAllLines( file.toPath(), StandardCharsets.UTF_8 ) )
{
- while ( ( strTmp = in.readLine() ) != null )
- {
- str.append( LINE_SEPARATOR );
- str.append( strTmp );
- }
- }
- finally
- {
- in.close();
+ str.append( LINE_SEPARATOR);
+ str.append( strTmp );
}
return str.toString();
@@ -241,26 +229,39 @@
}
assertTrue( new File( apidocs, "def/configuration/AppSample.html" ).exists() );
- assertTrue( new File( apidocs, "def/configuration/package-frame.html" ).exists() );
assertTrue( new File( apidocs, "def/configuration/package-summary.html" ).exists() );
assertTrue( new File( apidocs, "def/configuration/package-tree.html" ).exists() );
assertTrue( new File( apidocs, "def/configuration/package-use.html" ).exists() );
+ // package-frame and allclasses-(no)frame not generated anymore since Java 11
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) )
+ {
+ assertTrue( new File( apidocs, "def/configuration/package-frame.html" ).exists() );
+ assertTrue( new File( apidocs, "allclasses-frame.html" ).exists() );
+ assertTrue( new File( apidocs, "allclasses-noframe.html" ).exists() );
+ }
+
// class level generated javadoc files
assertTrue( new File( apidocs, "def/configuration/class-use/App.html" ).exists() );
assertTrue( new File( apidocs, "def/configuration/class-use/AppSample.html" ).exists() );
// project level generated javadoc files
- assertTrue( new File( apidocs, "allclasses-frame.html" ).exists() );
- assertTrue( new File( apidocs, "allclasses-noframe.html" ).exists() );
assertTrue( new File( apidocs, "constant-values.html" ).exists() );
assertTrue( new File( apidocs, "deprecated-list.html" ).exists() );
assertTrue( new File( apidocs, "help-doc.html" ).exists() );
assertTrue( new File( apidocs, "index-all.html" ).exists() );
assertTrue( new File( apidocs, "index.html" ).exists() );
assertTrue( new File( apidocs, "overview-tree.html" ).exists() );
- assertTrue( new File( apidocs, "package-list" ).exists() );
assertTrue( new File( apidocs, "stylesheet.css" ).exists() );
+
+ if ( JavaVersion.JAVA_VERSION.isAtLeast( "10" ) )
+ {
+ assertTrue( new File( apidocs, "element-list" ).exists() );
+ }
+ else
+ {
+ assertTrue( new File( apidocs, "package-list" ).exists() );
+ }
}
/**
@@ -314,8 +315,8 @@
throws Exception
{
// Should be an assumption, but not supported by TestCase
- // Seems like a bug in Javadoc 9
- if ( JavaVersion.JAVA_SPECIFICATION_VERSION.compareTo( JavaVersion.parse( "9" ) ) == 0 )
+ // Seems like a bug in Javadoc 9 and above
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast( "9" ) )
{
return;
}
@@ -393,21 +394,10 @@
File options = new File( apidocs, "options" );
assertTrue( options.isFile() );
- String contentOptions = null;
- Reader reader = null;
- try
- {
- reader = ReaderFactory.newPlatformReader( options );
- contentOptions = IOUtil.toString( reader );
- reader.close();
- reader = null;
- }
- finally
- {
- IOUtil.close( reader );
- }
- assertTrue( contentOptions != null );
+ String contentOptions = FileUtils.fileRead( options );
+
+ assertNotNull( contentOptions );
assertTrue( contentOptions.contains( "-link" ) );
assertTrue( contentOptions.contains( "http://java.sun.com/j2se/" ) );
}
@@ -495,8 +485,16 @@
assertTrue( new File( apidocs, "index-all.html" ).exists() );
assertTrue( new File( apidocs, "index.html" ).exists() );
assertTrue( new File( apidocs, "overview-tree.html" ).exists() );
- assertTrue( new File( apidocs, "package-list" ).exists() );
assertTrue( new File( apidocs, "stylesheet.css" ).exists() );
+
+ if ( JavaVersion.JAVA_VERSION.isBefore( "10" ) )
+ {
+ assertTrue( new File( apidocs, "package-list" ).exists() );
+ }
+ else
+ {
+ assertTrue( new File( apidocs, "element-list" ).exists() );
+ }
}
/**
@@ -539,7 +537,15 @@
// ----------------------------------------------------------------------
// taglet-test: check if a taglet is used
// ----------------------------------------------------------------------
-
+
+ // Should be an assumption, but not supported by TestCase
+ // com.sun.tools.doclets.Taglet not supported by Java9 anymore
+ // Should be refactored with jdk.javadoc.doclet.Taglet
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast( "10" ) )
+ {
+ return;
+ }
+
File testPom = new File( unit, "taglet-test/taglet-test-plugin-config.xml" );
JavadocReport mojo = lookupMojo( testPom );
@@ -661,7 +667,7 @@
assertTrue( content.contains( "<img src=\"doc-files/maven-feather.png\" alt=\"Maven\">" ) );
JavaVersion javadocVersion = (JavaVersion) getVariableValueFromObject( mojo, "javadocRuntimeVersion" );
- if( javadocVersion.isAtLeast( "1.8" ) && javadocVersion.isBefore( "10" ) )
+ if( javadocVersion.isAtLeast( "1.8" ) && javadocVersion.isBefore( "12" ) )
{
// https://bugs.openjdk.java.net/browse/JDK-8032205
assertTrue( "Javadoc runtime version: " + javadocVersion
@@ -713,9 +719,15 @@
String readed = readFile( app );
assertTrue( readed.contains( ">To do something:</" ) );
assertTrue( readed.contains( ">Generator Class:</" ) );
- assertTrue( readed.contains( ">Version:</" ) );
- assertTrue( readed.toLowerCase().contains( "</dt>" + LINE_SEPARATOR + " <dd>1.0</dd>" )
- || readed.toLowerCase().contains( "</dt>" + LINE_SEPARATOR + "<dd>1.0</dd>" /* JDK 8 */) );
+
+ // In javadoc-options-javadoc-resources.xml tag 'version' has only a name,
+ // which is not enough for Java 11 anymore
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) )
+ {
+ assertTrue( readed.contains( ">Version:</" ) );
+ assertTrue( readed.toLowerCase().contains( "</dt>" + LINE_SEPARATOR + " <dd>1.0</dd>" )
+ || readed.toLowerCase().contains( "</dt>" + LINE_SEPARATOR + "<dd>1.0</dd>" /* JDK 8 */) );
+ }
}
/**
@@ -734,7 +746,7 @@
}
catch ( MojoExecutionException e )
{
- assertTrue( "Doesnt handle correctly newline for header or footer parameter", false );
+ fail( "Doesnt handle correctly newline for header or footer parameter" );
}
assertTrue( true );
@@ -775,12 +787,20 @@
mojo.execute();
File apidocs = new File( getBasedir(), "target/test/unit/jdk6-test/target/site/apidocs" );
-
assertTrue( new File( apidocs, "index.html" ).exists() );
- File overviewSummary = new File( apidocs, "overview-summary.html" );
- assertTrue( overviewSummary.exists() );
- String content = readFile( overviewSummary );
+ File overview;
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) )
+ {
+ overview = new File( apidocs, "overview-summary.html" );
+ }
+ else
+ {
+ overview = new File( apidocs, "index.html" );
+ }
+
+ assertTrue( overview.exists() );
+ String content = readFile( overview );
assertTrue( content.contains( "Top - Copyright © All rights reserved." ) );
assertTrue( content.contains( "Header - Copyright © All rights reserved." ) );
assertTrue( content.contains( "Footer - Copyright © All rights reserved." ) );
@@ -952,7 +972,7 @@
try
{
mojo.execute();
- assertTrue( "No wrong encoding catch", false );
+ fail( "No wrong encoding catch" );
}
catch ( MojoExecutionException e )
{
@@ -963,7 +983,7 @@
try
{
mojo.execute();
- assertTrue( "No wrong docencoding catch", false );
+ fail( "No wrong docencoding catch" );
}
catch ( MojoExecutionException e )
{
@@ -974,7 +994,7 @@
try
{
mojo.execute();
- assertTrue( "No wrong charset catch", false );
+ fail( "No wrong charset catch" );
}
catch ( MojoExecutionException e )
{
@@ -987,7 +1007,7 @@
try
{
mojo.execute();
- assertTrue( "No wrong locale catch", false );
+ fail( "No wrong locale catch" );
}
catch ( MojoExecutionException e )
{
@@ -1004,7 +1024,7 @@
try
{
mojo.execute();
- assertTrue( "No conflict catch", false );
+ fail( "No conflict catch" );
}
catch ( MojoExecutionException e )
{
@@ -1020,6 +1040,13 @@
public void testTagletArtifacts()
throws Exception
{
+ // Should be an assumption, but not supported by TestCase
+ // com.sun.tools.doclets.Taglet not supported by Java 10 anymore
+ if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast( "10" ) )
+ {
+ return;
+ }
+
File testPom = new File( unit, "tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml" );
JavadocReport mojo = lookupMojo( testPom );
@@ -1100,7 +1127,7 @@
try
{
mojo.execute();
- assertTrue( false );
+ fail();
}
catch ( Exception e )
{
@@ -1112,7 +1139,16 @@
mojo.execute();
String content = readFile( stylesheetfile );
- assertTrue( content.contains( "/* Javadoc style sheet */" ) );
+ if ( JavaVersion.JAVA_VERSION.isAtLeast( "10" ) )
+ {
+ assertTrue( content.contains( "/* " + LINE_SEPARATOR
+ + " * Javadoc style sheet" + LINE_SEPARATOR
+ + " */" ) );
+ }
+ else
+ {
+ assertTrue( content.contains( "/* Javadoc style sheet */" ) );
+ }
String optionsContent = readFile( options );
assertFalse( optionsContent.contains( "-stylesheetfile" ) );
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
index fa5bfaa..825c2a0 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
@@ -39,7 +39,6 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.maven.plugins.javadoc.JavadocUtil;
import org.apache.maven.plugins.javadoc.ProxyServer.AuthAsyncProxyServlet;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Settings;
@@ -69,7 +68,7 @@
try
{
JavadocUtil.extractJavadocVersion( version );
- assertTrue( "Not catch null", false );
+ fail( "Not catch null" );
}
catch ( IllegalArgumentException e )
{
@@ -179,7 +178,7 @@
try
{
JavadocUtil.parseJavadocMemory( memory );
- assertTrue( "Not catch null", false );
+ fail( "Not catch null" );
}
catch ( IllegalArgumentException e )
{
@@ -223,7 +222,7 @@
try
{
JavadocUtil.parseJavadocMemory( memory );
- assertTrue( "Not catch wrong pattern", false );
+ fail( "Not catch wrong pattern" );
}
catch ( IllegalArgumentException e )
{
@@ -233,7 +232,7 @@
try
{
JavadocUtil.parseJavadocMemory( memory );
- assertTrue( "Not catch wrong pattern", false );
+ fail( "Not catch wrong pattern" );
}
catch ( IllegalArgumentException e )
{
@@ -751,7 +750,7 @@
public void testUnifyPathSeparator()
throws Exception
{
- assertEquals( null, JavadocUtil.unifyPathSeparator( null ) );
+ assertNull( JavadocUtil.unifyPathSeparator( null ) );
final String ps = File.pathSeparator;
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
index 0a4f1eb..0f0bc23 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
@@ -19,13 +19,12 @@
* under the License.
*/
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.maven.plugins.javadoc.JavadocVersion;
import org.junit.Test;
public class JavadocVersionTest
@@ -42,9 +41,9 @@
assertTrue( JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.5" ) ) < 0 );
assertTrue( JavadocVersion.parse( "1.8" ).compareTo( JavadocVersion.parse( "9" ) ) < 0 );
- assertTrue( JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.4" ) ) == 0 );
- assertTrue( JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4.2" ) ) == 0 );
- assertTrue( JavadocVersion.parse( "9" ).compareTo( JavadocVersion.parse( "9" ) ) == 0 );
+ assertEquals( 0, JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.4" ) ) );
+ assertEquals( 0, JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4.2" ) ) );
+ assertEquals( 0, JavadocVersion.parse( "9" ).compareTo( JavadocVersion.parse( "9" ) ) );
assertTrue( JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4" ) ) > 0 );
assertTrue( JavadocVersion.parse( "1.5" ).compareTo( JavadocVersion.parse( "1.4" ) ) > 0 );