Merge modifications done during partial git migration
Conflicts:
src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
diff --git a/pom.xml b/pom.xml
index 62517dd..bb0249b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -292,7 +292,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>1.8.5</version>
+ <version>2.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/pom.xml b/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/pom.xml
new file mode 100644
index 0000000..6c807c4
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>mjavadoc489</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>bar</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>foo</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/src/main/java/com/bar/OtherClass.java b/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/src/main/java/com/bar/OtherClass.java
new file mode 100644
index 0000000..dcfc6ed
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/src/main/java/com/bar/OtherClass.java
@@ -0,0 +1,25 @@
+package com.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 OtherClass
+{
+ private com.foo.MyClass myClass;
+}
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/src/main/java/module-info.java b/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/src/main/java/module-info.java
new file mode 100644
index 0000000..b9fe87f
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/bar/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.
+ */
+module com.bar
+{
+ requires com.foo;
+
+ // workaround javadoc bug;
+ exports com.bar;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/pom.xml b/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/pom.xml
new file mode 100644
index 0000000..0a63d7c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>mjavadoc489</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>baz</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc-aggregate</id>
+ <phase>package</phase>
+ <goals>
+ <goal>javadoc-no-fork</goal>
+ </goals>
+ <configuration>
+ <includeDependencySources>true</includeDependencySources>
+ <includeTransitiveDependencySources>true</includeTransitiveDependencySources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>bar</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/src/main/java/com/baz/LonelyClass.java b/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/src/main/java/com/baz/LonelyClass.java
new file mode 100644
index 0000000..7677263
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/src/main/java/com/baz/LonelyClass.java
@@ -0,0 +1,25 @@
+package com.baz;
+
+/*
+ * 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 LonelyClass
+{
+
+}
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/src/main/java/module-info.java b/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/src/main/java/module-info.java
new file mode 100644
index 0000000..3df87ee
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/baz/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.
+ */
+module com.baz
+{
+ requires com.bar;
+
+ // workaround javadoc bug;
+ exports com.baz;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/pom.xml b/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/pom.xml
new file mode 100644
index 0000000..3f07a01
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/pom.xml
@@ -0,0 +1,32 @@
+<?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">
+
+ <parent>
+ <groupId>org.apache.maven.plugins.javadoc.it</groupId>
+ <artifactId>mjavadoc489</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>foo</artifactId>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/src/main/java/com/foo/MyClass.java b/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/src/main/java/com/foo/MyClass.java
new file mode 100644
index 0000000..dae085a
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/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-498_aggr_modulepath/foo/src/main/java/module-info.java b/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/src/main/java/module-info.java
new file mode 100644
index 0000000..ed1b6bf
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/foo/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 com.foo
+{
+ exports com.foo;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/invoker.properties b/src/it/projects/MJAVADOC-498_aggr_modulepath/invoker.properties
new file mode 100644
index 0000000..9511718
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.java.version = 9+
diff --git a/src/it/projects/MJAVADOC-498_aggr_modulepath/pom.xml b/src/it/projects/MJAVADOC-498_aggr_modulepath/pom.xml
new file mode 100644
index 0000000..aa3813c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-498_aggr_modulepath/pom.xml
@@ -0,0 +1,68 @@
+<?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>mjavadoc489</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <url>https://issues.apache.org/jira/browse/MJAVADOC-489</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <modules>
+ <module>foo</module>
+ <module>bar</module>
+ <module>baz</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.7.0</version>
+ <configuration>
+ <release>9</release>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 9897f83..afe3654 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -23,6 +23,7 @@
import org.apache.commons.lang3.JavaVersion;
import org.apache.commons.lang3.SystemUtils;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -110,6 +111,8 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -117,6 +120,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
@@ -132,7 +136,6 @@
import static org.apache.maven.plugins.javadoc.JavadocUtil.toList;
import static org.apache.maven.plugins.javadoc.JavadocUtil.isEmpty;
import static org.apache.maven.plugins.javadoc.JavadocUtil.isNotEmpty;
-import static org.codehaus.plexus.util.IOUtil.close;
/**
* Base class with majority of Javadoc functionalities.
@@ -1746,12 +1749,11 @@
static
{
- DEFAULT_JAVA_API_LINKS.put( "api_1.3", "http://docs.oracle.com/javase/1.3/docs/api/" );
- DEFAULT_JAVA_API_LINKS.put( "api_1.4", "http://docs.oracle.com/javase/1.4.2/docs/api/" );
- DEFAULT_JAVA_API_LINKS.put( "api_1.5", "http://docs.oracle.com/javase/1.5.0/docs/api/" );
- DEFAULT_JAVA_API_LINKS.put( "api_1.6", "http://docs.oracle.com/javase/6/docs/api/" );
- DEFAULT_JAVA_API_LINKS.put( "api_1.7", "http://docs.oracle.com/javase/7/docs/api/" );
- DEFAULT_JAVA_API_LINKS.put( "api_1.8", "http://docs.oracle.com/javase/8/docs/api/" );
+ DEFAULT_JAVA_API_LINKS.put( "api_1.5", "https://docs.oracle.com/javase/1.5.0/docs/api/" );
+ DEFAULT_JAVA_API_LINKS.put( "api_1.6", "https://docs.oracle.com/javase/6/docs/api/" );
+ 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/" );
}
// ----------------------------------------------------------------------
@@ -1908,7 +1910,6 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
- getLog().debug( "verify removed parameter" );
verifyRemovedParameter( "aggregator" );
verifyRemovedParameter( "proxyHost" );
verifyRemovedParameter( "proxyPort" );
@@ -1986,15 +1987,18 @@
throw new MavenReportException( "Failed to generate javadoc options file: " + e.getMessage(), e );
}
- List<String> sourcePaths = getSourcePaths();
- List<String> files = getFiles( sourcePaths );
+ Map<String, Collection<String>> sourcePaths = getSourcePaths();
+
+ Collection<String> collectedSourcePaths = collect( sourcePaths.values() );
+
+ List<String> files = getFiles( collectedSourcePaths );
if ( !canGenerateReport( files ) )
{
return;
}
- List<String> packageNames = getPackageNames( sourcePaths, files );
- List<String> filesWithUnnamedPackages = getFilesWithUnnamedPackages( sourcePaths, files );
+ List<String> packageNames = getPackageNames( collectedSourcePaths, files );
+ List<String> filesWithUnnamedPackages = getFilesWithUnnamedPackages( collectedSourcePaths, files );
// ----------------------------------------------------------------------
// Find the javadoc executable and version
@@ -2068,7 +2072,7 @@
// Wrap Javadoc options
// ----------------------------------------------------------------------
- addJavadocOptions( arguments, sourcePaths );
+ addJavadocOptions( javadocOutputDirectory, arguments, sourcePaths );
// ----------------------------------------------------------------------
// Wrap Standard doclet Options
@@ -2186,14 +2190,24 @@
}
}
+ protected final Collection<String> collect( Collection<Collection<String>> sourcePaths )
+ {
+ Collection<String> collectedSourcePaths = new LinkedHashSet<>();
+ for ( Collection<String> sp : sourcePaths )
+ {
+ collectedSourcePaths.addAll( sp );
+ }
+ return collectedSourcePaths;
+ }
+
/**
* Method to get the files on the specified source paths
*
- * @param sourcePaths a List that contains the paths to the source files
+ * @param sourcePaths a Collection that contains the paths to the source files
* @return a List that contains the specific path for every source file
* @throws MavenReportException {@link MavenReportException}
*/
- protected List<String> getFiles( List<String> sourcePaths )
+ protected List<String> getFiles( Collection<String> sourcePaths )
throws MavenReportException
{
List<String> files = new ArrayList<>();
@@ -2216,18 +2230,20 @@
* Method to get the source paths. If no source path is specified in the parameter, the compile source roots
* of the project will be used.
*
- * @return a List of the project absolute source paths as <code>String</code>
+ * @return a Collection of the project absolute source paths as <code>String</code>
* @throws MavenReportException {@link MavenReportException}
* @see JavadocUtil#pruneDirs(MavenProject, List)
*/
- protected List<String> getSourcePaths()
+ protected Map<String, Collection<String>> getSourcePaths()
throws MavenReportException
{
- List<String> sourcePaths;
+ Map<String, Collection<String>> mappedSourcePaths = new LinkedHashMap<>();
if ( StringUtils.isEmpty( sourcepath ) )
{
- sourcePaths = new ArrayList<>( JavadocUtil.pruneDirs( project, getProjectSourceRoots( project ) ) );
+
+ Set<String> sourcePaths =
+ new LinkedHashSet<>( JavadocUtil.pruneDirs( project, getProjectSourceRoots( project ) ) );
if ( project.getExecutionProject() != null )
{
@@ -2244,15 +2260,17 @@
File javadocDir = getJavadocDirectory();
if ( javadocDir.exists() && javadocDir.isDirectory() )
{
- List<String> l = JavadocUtil.pruneDirs( project, Collections.singletonList(
+ Collection<String> l = JavadocUtil.pruneDirs( project, Collections.singletonList(
getJavadocDirectory().getAbsolutePath() ) );
sourcePaths.addAll( l );
}
}
-
+ mappedSourcePaths.put( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ),
+ sourcePaths );
+
if ( includeDependencySources )
{
- sourcePaths.addAll( getDependencySourcePaths() );
+ mappedSourcePaths.putAll( getDependencySourcePaths() );
}
if ( isAggregator() && project.isExecutionRoot() )
@@ -2261,6 +2279,8 @@
{
if ( subProject != project )
{
+ Collection<String> additionalSourcePaths = new ArrayList<>();
+
List<String> sourceRoots = getProjectSourceRoots( subProject );
if ( subProject.getExecutionProject() != null )
@@ -2271,7 +2291,7 @@
ArtifactHandler artifactHandler = subProject.getArtifact().getArtifactHandler();
if ( "java".equals( artifactHandler.getLanguage() ) )
{
- sourcePaths.addAll( JavadocUtil.pruneDirs( subProject, sourceRoots ) );
+ additionalSourcePaths.addAll( JavadocUtil.pruneDirs( subProject, sourceRoots ) );
}
if ( getJavadocDirectory() != null )
@@ -2282,30 +2302,33 @@
File javadocDir = new File( subProject.getBasedir(), javadocDirRelative );
if ( javadocDir.exists() && javadocDir.isDirectory() )
{
- List<String> l = JavadocUtil.pruneDirs( subProject, Collections.singletonList(
+ Collection<String> l = JavadocUtil.pruneDirs( subProject, Collections.singletonList(
javadocDir.getAbsolutePath() ) );
- sourcePaths.addAll( l );
+ additionalSourcePaths.addAll( l );
}
}
+ mappedSourcePaths.put( ArtifactUtils.versionlessKey( subProject.getGroupId(),
+ subProject.getArtifactId() ),
+ additionalSourcePaths );
}
}
}
}
else
{
- sourcePaths = new ArrayList<>( Arrays.asList( JavadocUtil.splitPath( sourcepath ) ) );
+ Collection<String> sourcePaths = new ArrayList<>( Arrays.asList( JavadocUtil.splitPath( sourcepath ) ) );
sourcePaths = JavadocUtil.pruneDirs( project, sourcePaths );
if ( getJavadocDirectory() != null )
{
- List<String> l = JavadocUtil.pruneDirs( project, Collections.singletonList(
+ Collection<String> l = JavadocUtil.pruneDirs( project, Collections.singletonList(
getJavadocDirectory().getAbsolutePath() ) );
sourcePaths.addAll( l );
}
+ mappedSourcePaths.put( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ),
+ sourcePaths );
}
- sourcePaths = JavadocUtil.pruneDirs( project, sourcePaths );
-
- return sourcePaths;
+ return mappedSourcePaths;
}
/**
@@ -2325,7 +2348,7 @@
* @return List of source paths.
* @throws MavenReportException {@link MavenReportException}
*/
- protected final List<String> getDependencySourcePaths()
+ protected final Map<String, Collection<String>> getDependencySourcePaths()
throws MavenReportException
{
try
@@ -2445,11 +2468,11 @@
* Method to get the excluded source files from the javadoc and create the argument string
* that will be included in the javadoc commandline execution.
*
- * @param sourcePaths the list of paths to the source files
+ * @param sourcePaths the collection of paths to the source files
* @return a String that contains the exclude argument that will be used by javadoc
* @throws MavenReportException
*/
- private String getExcludedPackages( List<String> sourcePaths )
+ private String getExcludedPackages( Collection<String> sourcePaths )
throws MavenReportException
{
List<String> excludedNames = null;
@@ -2480,7 +2503,7 @@
* string (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
* @see File#pathSeparator
*/
- private String getSourcePath( List<String> sourcePaths )
+ private String getSourcePath( Collection<String> sourcePaths )
{
String sourcePath = null;
@@ -2606,43 +2629,40 @@
{
classpathElements.addAll( getProjectBuildOutputDirs( subProject ) );
- if ( session != null )
+ try
{
- try
+ StringBuilder sb = new StringBuilder();
+
+ sb.append( "Compiled artifacts for " );
+ sb.append( subProject.getGroupId() ).append( ":" );
+ sb.append( subProject.getArtifactId() ).append( ":" );
+ sb.append( subProject.getVersion() ).append( '\n' );
+
+ ProjectBuildingRequest buildingRequest = session.getProjectBuildingRequest();
+ buildingRequest =
+ buildingRequest.setRemoteRepositories( subProject.getRemoteArtifactRepositories() );
+
+ for ( ArtifactResult artifactResult
+ : dependencyResolver.resolveDependencies( buildingRequest,
+ subProject.getDependencies(),
+ null,
+ dependencyFilter ) )
{
- StringBuilder sb = new StringBuilder();
-
- sb.append( "Compiled artifacts for " );
- sb.append( subProject.getGroupId() ).append( ":" );
- sb.append( subProject.getArtifactId() ).append( ":" );
- sb.append( subProject.getVersion() ).append( '\n' );
-
- ProjectBuildingRequest buildingRequest = session.getProjectBuildingRequest();
- buildingRequest =
- buildingRequest.setRemoteRepositories( subProject.getRemoteArtifactRepositories() );
+ populateCompileArtifactMap( compileArtifactMap,
+ Collections.singletonList( artifactResult.getArtifact() ) );
- for ( ArtifactResult artifactResult
- : dependencyResolver.resolveDependencies( buildingRequest,
- subProject.getDependencies(),
- null,
- dependencyFilter ) )
- {
- populateCompileArtifactMap( compileArtifactMap,
- Collections.singletonList( artifactResult.getArtifact() ) );
-
- sb.append( artifactResult.getArtifact().getFile() ).append( '\n' );
- }
-
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( sb.toString() );
- }
-
+ sb.append( artifactResult.getArtifact().getFile() ).append( '\n' );
}
- catch ( DependencyResolverException e )
+
+ if ( getLog().isDebugEnabled() )
{
- throw new MavenReportException( e.getMessage(), e );
+ getLog().debug( sb.toString() );
}
+
+ }
+ catch ( DependencyResolverException e )
+ {
+ throw new MavenReportException( e.getMessage(), e );
}
}
}
@@ -3058,7 +3078,7 @@
throws MavenReportException
{
Set<TagletArtifact> tArtifacts = collectTagletArtifacts();
- List<String> pathParts = new ArrayList<>();
+ Collection<String> pathParts = new ArrayList<>();
for ( TagletArtifact tagletArtifact : tArtifacts )
{
@@ -4293,7 +4313,7 @@
* @param files not null
* @return the list of package names for files in the sourcePaths
*/
- private List<String> getPackageNames( List<String> sourcePaths, List<String> files )
+ private List<String> getPackageNames( Collection<String> sourcePaths, List<String> files )
{
return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, true );
}
@@ -4303,7 +4323,7 @@
* @param files not null
* @return a list files with unnamed package names for files in the sourecPaths
*/
- private List<String> getFilesWithUnnamedPackages( List<String> sourcePaths, List<String> files )
+ private List<String> getFilesWithUnnamedPackages( Collection<String> sourcePaths, List<String> files )
{
return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, false );
}
@@ -4316,7 +4336,7 @@
* @see #getFiles(List)
* @see #getSourcePaths()
*/
- private List<String> getPackageNamesOrFilesWithUnnamedPackages( List<String> sourcePaths, List<String> files,
+ private List<String> getPackageNamesOrFilesWithUnnamedPackages( Collection<String> sourcePaths, List<String> files,
boolean onlyPackageName )
{
List<String> returnList = new ArrayList<>();
@@ -4628,14 +4648,19 @@
* The <a href="package-summary.html#Standard_Javadoc_Options">package documentation</a> details the
* Standard Javadoc Options wrapped by this Plugin.
*
+ * @param javadocOutputDirectory not null
* @param arguments not null
* @param sourcePaths 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>
*/
- private void addJavadocOptions( List<String> arguments, List<String> sourcePaths )
+ private void addJavadocOptions( File javadocOutputDirectory,
+ List<String> arguments,
+ Map<String, Collection<String>> allSourcePaths )
throws MavenReportException
{
+ Collection<String> sourcePaths = collect( allSourcePaths.values() );
+
validateJavadocOptions();
// see com.sun.tools.javadoc.Start#parseAndExecute(String argv[])
@@ -4665,10 +4690,11 @@
List<String> roots = getProjectSourceRoots( getProject() );
File mainDescriptor = findMainDescriptor( roots );
-
+
+ final LocationManager locationManager = new LocationManager();
+
if ( mainDescriptor != null && !isTest() )
{
- LocationManager locationManager = new LocationManager();
ResolvePathsRequest<File> request =
ResolvePathsRequest.withFiles( getPathElements() ).setMainModuleDescriptor( mainDescriptor );
try
@@ -4678,9 +4704,15 @@
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( result.getModulepathElements().keySet().iterator(), File.pathSeparator );
- getLog().info( "modulepath: " + modulepath );
+ StringUtils.join( modulePathElements.iterator(), File.pathSeparator );
addArgIfNotEmpty( arguments, "--module-path", JavadocUtil.quotedPathArgument( modulepath ) );
}
catch ( IOException e )
@@ -4694,6 +4726,59 @@
addArgIfNotEmpty( arguments, "-classpath", JavadocUtil.quotedPathArgument( classpath ) );
}
+ Collection<String> reactorKeys = new HashSet<>( session.getProjects().size() );
+ for ( MavenProject reactorProject : session.getProjects() )
+ {
+ reactorKeys.add( ArtifactUtils.versionlessKey( reactorProject.getGroupId(),
+ reactorProject.getArtifactId() ) );
+ }
+
+ Path moduleSourceDir = null;
+ if ( allSourcePaths.size() > 1 )
+ {
+ for ( Map.Entry<String, Collection<String>> projectSourcepaths : allSourcePaths.entrySet() )
+ {
+ if ( reactorKeys.contains( projectSourcepaths.getKey() ) )
+ {
+ File moduleDescriptor = findMainDescriptor( projectSourcepaths.getValue() );
+ if ( moduleDescriptor != null )
+ {
+ moduleSourceDir = javadocOutputDirectory.toPath().resolve( "src" );
+ try
+ {
+ moduleSourceDir = Files.createDirectories( moduleSourceDir );
+ ResolvePathsRequest<File> request =
+ ResolvePathsRequest.withFiles( Collections.<File>emptyList() )
+ .setMainModuleDescriptor( moduleDescriptor );
+
+ String moduleName =
+ locationManager.resolvePaths( request ).getMainModuleDescriptor().name();
+
+ addArgIfNotEmpty( arguments, "--patch-module", moduleName + '='
+ + JavadocUtil.quotedPathArgument( getSourcePath( projectSourcepaths.getValue() ) ) );
+
+ Files.createDirectory( moduleSourceDir.resolve( moduleName ) );
+ }
+ catch ( IOException e )
+ {
+ throw new MavenReportException( e.getMessage() );
+ }
+ }
+ else
+ {
+ // todo
+ getLog().error( "no module descriptor for " + projectSourcepaths.getKey() );
+ }
+ }
+ else
+ {
+ // todo
+ getLog().error( "no reactor project: " + projectSourcepaths.getKey() );
+
+ }
+ }
+ }
+
if ( StringUtils.isNotEmpty( doclet ) )
{
addArgIfNotEmpty( arguments, "-doclet", JavadocUtil.quotedArgument( doclet ) );
@@ -4730,7 +4815,18 @@
{
sourcepath = StringUtils.join( sourcePaths.iterator(), File.pathSeparator );
}
- addArgIfNotEmpty( arguments, "-sourcepath", JavadocUtil.quotedPathArgument( getSourcePath( sourcePaths ) ) );
+
+ if ( moduleSourceDir != null )
+ {
+ addArgIfNotEmpty( arguments, "--module-source-path",
+ JavadocUtil.quotedPathArgument( moduleSourceDir.toString() ) );
+ }
+ else
+ {
+ addArgIfNotEmpty( arguments, "-sourcepath",
+ JavadocUtil.quotedPathArgument( getSourcePath( sourcePaths ) ) );
+ }
+
if ( StringUtils.isNotEmpty( sourcepath ) && isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) )
{
@@ -4751,7 +4847,7 @@
}
}
- private File findMainDescriptor( List<String> roots )
+ private File findMainDescriptor( Collection<String> roots )
{
for ( String root : roots )
{
@@ -6033,16 +6129,11 @@
}
File optionsFile = getJavadocOptionsFile();
- Writer writer = null;
- try
+
+ try ( Writer writer = WriterFactory.newXmlWriter( optionsFile ) )
{
- writer = WriterFactory.newXmlWriter( optionsFile );
new JavadocOptionsXpp3Writer().write( writer, options );
}
- finally
- {
- close( writer );
- }
return options;
}
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 0274c89..f431114 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
@@ -20,6 +20,7 @@
*/
import java.io.File;
+import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -235,11 +236,11 @@
if ( !this.isAggregator() || ( this.isAggregator() && this.project.isExecutionRoot() ) )
{
- List<String> sourcePaths;
+ Collection<String> sourcePaths;
List<String> files;
try
{
- sourcePaths = getSourcePaths();
+ sourcePaths = collect( getSourcePaths().values() );
files = getFiles( sourcePaths );
}
catch ( MavenReportException 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 5844d66..4dc7631 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -78,10 +78,12 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.NoSuchElementException;
import java.util.Properties;
+import java.util.Set;
import java.util.StringTokenizer;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
@@ -112,12 +114,12 @@
* directory <code>String</code> path.
*
* @param project the current Maven project not null
- * @param dirs the list of <code>String</code> directories path that will be validated.
+ * @param dirs the collection of <code>String</code> directories path that will be validated.
* @return a List of valid <code>String</code> directories absolute paths.
*/
- public static List<String> pruneDirs( MavenProject project, List<String> dirs )
+ public static Collection<String> pruneDirs( MavenProject project, Collection<String> dirs )
{
- List<String> pruned = new ArrayList<>( dirs.size() );
+ Set<String> pruned = new LinkedHashSet<>( dirs.size() );
for ( String dir : dirs )
{
if ( dir == null )
@@ -131,7 +133,7 @@
directory = new File( project.getBasedir(), directory.getPath() );
}
- if ( directory.isDirectory() && !pruned.contains( directory.getAbsolutePath() ) )
+ if ( directory.isDirectory() )
{
pruned.add( directory.getAbsolutePath() );
}
@@ -147,7 +149,7 @@
* @param files the list of <code>String</code> files paths that will be validated.
* @return a List of valid <code>File</code> objects.
*/
- protected static List<String> pruneFiles( List<String> files )
+ protected static List<String> pruneFiles( Collection<String> files )
{
List<String> pruned = new ArrayList<>( files.size() );
for ( String f : files )
@@ -191,7 +193,7 @@
* @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( List<String> sourcePaths, String[] subpackagesList,
+ protected static List<String> getExcludedNames( Collection<String> sourcePaths, String[] subpackagesList,
String[] excludedPackages )
{
List<String> excludedNames = new ArrayList<>();
@@ -1275,14 +1277,22 @@
*/
private static File getJavaHome( Log log )
{
- File javaHome;
- if ( SystemUtils.IS_OS_MAC_OSX )
+ File javaHome = null;
+
+ // if maven.home is set, we can assume JAVA_HOME must be used for testing
+
+ if ( System.getProperty( "maven.home" ) == null )
{
- javaHome = SystemUtils.getJavaHome();
- }
- else
- {
- javaHome = new File( SystemUtils.getJavaHome(), ".." );
+ // JEP220 (Java9) restructured the JRE/JDK runtime image
+ if ( ( SystemUtils.IS_OS_MAC_OSX
+ || JavadocVersion.parse( SystemUtils.JAVA_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 ) )
+ {
+ javaHome = SystemUtils.getJavaHome();
+ }
+ else
+ {
+ javaHome = new File( SystemUtils.getJavaHome(), ".." );
+ }
}
if ( javaHome == null || !javaHome.exists() )
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 c24c62b..b4d331f 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
@@ -24,12 +24,17 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
@@ -39,11 +44,11 @@
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.plugins.javadoc.options.JavadocOptions;
-import org.apache.maven.plugins.javadoc.options.io.xpp3.JavadocOptionsXpp3Reader;
import org.apache.maven.plugins.javadoc.AbstractJavadocMojo;
import org.apache.maven.plugins.javadoc.JavadocUtil;
import org.apache.maven.plugins.javadoc.ResourcesBundleMojo;
+import org.apache.maven.plugins.javadoc.options.JavadocOptions;
+import org.apache.maven.plugins.javadoc.options.io.xpp3.JavadocOptionsXpp3Reader;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.artifact.filter.resolve.transform.ArtifactIncludeFilterTransformer;
import org.apache.maven.shared.artifact.resolve.ArtifactResolver;
@@ -143,11 +148,11 @@
* @throws ArtifactResolutionException {@link ArtifactResolutionException}
* @throws ArtifactNotFoundException {@link ArtifactNotFoundException}
*/
- public List<String> resolveDependencySourcePaths( final SourceResolverConfig config )
+ public Map<String, Collection<String>> resolveDependencySourcePaths( final SourceResolverConfig config )
throws ArtifactResolutionException, ArtifactNotFoundException
{
- final List<String> dirs = new ArrayList<>();
-
+ final Map<String, Collection<String>> mappedDirs = new LinkedHashMap<>();
+
final Map<String, MavenProject> projectMap = new HashMap<>();
if ( config.reactorProjects() != null )
{
@@ -166,7 +171,7 @@
final MavenProject p = projectMap.get( key );
if ( p != null )
{
- dirs.addAll( resolveFromProject( config, p, artifact ) );
+ mappedDirs.put( key, resolveFromProject( config, p, artifact ) );
}
else
{
@@ -174,9 +179,12 @@
}
}
- dirs.addAll( resolveFromArtifacts( config, forResourceResolution ) );
+ for ( Map.Entry<String, String> entry : resolveFromArtifacts( config, forResourceResolution ) )
+ {
+ mappedDirs.put( entry.getKey(), Collections.singletonList( entry.getValue() ) );
+ }
- return dirs;
+ return mappedDirs;
}
private static List<JavadocBundle> resolveBundleFromProject( SourceResolverConfig config, MavenProject project,
@@ -262,10 +270,14 @@
}
}
- List<String> dirs = null;
+ List<String> dirs = new ArrayList<>( toResolve.size() );
try
{
- dirs = resolveAndUnpack( toResolve, config, RESOURCE_VALID_CLASSIFIERS, false );
+ for ( Map.Entry<String, String> entry : resolveAndUnpack( toResolve, config, RESOURCE_VALID_CLASSIFIERS,
+ false ) )
+ {
+ dirs.add( entry.getValue() );
+ }
}
catch ( ArtifactResolutionException e )
{
@@ -284,44 +296,35 @@
List<JavadocBundle> result = new ArrayList<>();
- if ( dirs != null )
+ for ( String d : dirs )
{
- for ( String d : dirs )
- {
- File dir = new File( d );
- File resources = new File( dir, ResourcesBundleMojo.RESOURCES_DIR_PATH );
- JavadocOptions options = null;
+ File dir = new File( d );
+ File resources = new File( dir, ResourcesBundleMojo.RESOURCES_DIR_PATH );
+ JavadocOptions options = null;
- File javadocOptions = new File( dir, ResourcesBundleMojo.BUNDLE_OPTIONS_PATH );
- if ( javadocOptions.exists() )
+ File javadocOptions = new File( dir, ResourcesBundleMojo.BUNDLE_OPTIONS_PATH );
+ if ( javadocOptions.exists() )
+ {
+ try ( FileInputStream reader = new FileInputStream( javadocOptions ) )
{
- FileInputStream reader = null;
- try
- {
- reader = new FileInputStream( javadocOptions );
- options = new JavadocOptionsXpp3Reader().read( reader );
- }
- catch ( XmlPullParserException e )
- {
- IOException error = new IOException( "Failed to parse javadoc options: " + e.getMessage() );
- error.initCause( e );
-
- throw error;
- }
- finally
- {
- close( reader );
- }
+ options = new JavadocOptionsXpp3Reader().read( reader );
}
-
- result.add( new JavadocBundle( options, resources ) );
+ catch ( XmlPullParserException e )
+ {
+ IOException error = new IOException( "Failed to parse javadoc options: " + e.getMessage() );
+ error.initCause( e );
+
+ throw error;
+ }
}
+
+ result.add( new JavadocBundle( options, resources ) );
}
return result;
}
- private List<String> resolveFromArtifacts( final SourceResolverConfig config,
+ private Collection<Entry<String, String>> resolveFromArtifacts( final SourceResolverConfig config,
final List<Artifact> artifacts )
throws ArtifactResolutionException, ArtifactNotFoundException
{
@@ -363,8 +366,20 @@
return a;
}
- private List<String> resolveAndUnpack( final List<Artifact> artifacts, final SourceResolverConfig config,
- final List<String> validClassifiers, final boolean propagateErrors )
+ /**
+ *
+ * @param artifacts the artifacts to resolve
+ * @param config the configuration
+ * @param validClassifiers
+ * @param propagateErrors
+ * @return list of <dependencyConflictId, absolutePath>
+ * @throws ArtifactResolutionException if an exception occurs
+ * @throws ArtifactNotFoundException if an exception occurs
+ */
+ private Collection<Map.Entry<String, String>> resolveAndUnpack( final List<Artifact> artifacts,
+ final SourceResolverConfig config,
+ final List<String> validClassifiers,
+ final boolean propagateErrors )
throws ArtifactResolutionException, ArtifactNotFoundException
{
// NOTE: Since these are '-sources' and '-test-sources' artifacts, they won't actually
@@ -382,7 +397,7 @@
filter = null;
}
- final List<String> result = new ArrayList<>( artifacts.size() );
+ final List<Map.Entry<String, String>> result = new ArrayList<>( artifacts.size() );
for ( final Artifact a : artifactSet )
{
if ( !validClassifiers.contains( a.getClassifier() ) || ( filter != null && !filter.include( a ) ) )
@@ -417,7 +432,8 @@
unArchiver.extract();
- result.add( d.getAbsolutePath() );
+ result.add( new AbstractMap.SimpleEntry<String, String>( a.getDependencyConflictId(),
+ d.getAbsolutePath() ) );
}
catch ( final NoSuchArchiverException e )
{
@@ -439,7 +455,7 @@
return result;
}
- private static List<String> resolveFromProject( final SourceResolverConfig config,
+ private static Collection<String> resolveFromProject( final SourceResolverConfig config,
final MavenProject reactorProject, final Artifact artifact )
{
final List<String> dirs = new ArrayList<>();
diff --git a/src/main/resources/org/apache/maven/plugins/javadoc/java-api-package-list-9 b/src/main/resources/org/apache/maven/plugins/javadoc/java-api-package-list-9
new file mode 100644
index 0000000..6c0283f
--- /dev/null
+++ b/src/main/resources/org/apache/maven/plugins/javadoc/java-api-package-list-9
@@ -0,0 +1,315 @@
+com.sun.jarsigner
+com.sun.java.accessibility.util
+com.sun.javadoc
+com.sun.jdi
+com.sun.jdi.connect
+com.sun.jdi.connect.spi
+com.sun.jdi.event
+com.sun.jdi.request
+com.sun.management
+com.sun.net.httpserver
+com.sun.net.httpserver.spi
+com.sun.nio.sctp
+com.sun.security.auth
+com.sun.security.auth.callback
+com.sun.security.auth.login
+com.sun.security.auth.module
+com.sun.security.jgss
+com.sun.source.doctree
+com.sun.source.tree
+com.sun.source.util
+com.sun.tools.attach
+com.sun.tools.attach.spi
+com.sun.tools.doclets
+com.sun.tools.doclets.standard
+com.sun.tools.javac
+com.sun.tools.javadoc
+com.sun.tools.jconsole
+java.applet
+java.awt
+java.awt.color
+java.awt.datatransfer
+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
+java.io
+java.lang
+java.lang.annotation
+java.lang.instrument
+java.lang.invoke
+java.lang.management
+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.rmi
+java.rmi.activation
+java.rmi.dgc
+java.rmi.registry
+java.rmi.server
+java.security
+java.security.acl
+java.security.cert
+java.security.interfaces
+java.security.spec
+java.sql
+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.logging
+java.util.prefs
+java.util.regex
+java.util.spi
+java.util.stream
+java.util.zip
+javafx.animation
+javafx.application
+javafx.beans
+javafx.beans.binding
+javafx.beans.property
+javafx.beans.property.adapter
+javafx.beans.value
+javafx.collections
+javafx.collections.transformation
+javafx.concurrent
+javafx.css
+javafx.css.converter
+javafx.embed.swing
+javafx.event
+javafx.fxml
+javafx.geometry
+javafx.print
+javafx.scene
+javafx.scene.canvas
+javafx.scene.chart
+javafx.scene.control
+javafx.scene.control.cell
+javafx.scene.control.skin
+javafx.scene.effect
+javafx.scene.image
+javafx.scene.input
+javafx.scene.layout
+javafx.scene.media
+javafx.scene.paint
+javafx.scene.shape
+javafx.scene.text
+javafx.scene.transform
+javafx.scene.web
+javafx.stage
+javafx.util
+javafx.util.converter
+javax.accessibility
+javax.activation
+javax.activity
+javax.annotation
+javax.annotation.processing
+javax.crypto
+javax.crypto.interfaces
+javax.crypto.spec
+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.jnlp
+javax.jws
+javax.jws.soap
+javax.lang.model
+javax.lang.model.element
+javax.lang.model.type
+javax.lang.model.util
+javax.management
+javax.management.loading
+javax.management.modelmbean
+javax.management.monitor
+javax.management.openmbean
+javax.management.relation
+javax.management.remote
+javax.management.remote.rmi
+javax.management.timer
+javax.naming
+javax.naming.directory
+javax.naming.event
+javax.naming.ldap
+javax.naming.spi
+javax.net
+javax.net.ssl
+javax.print
+javax.print.attribute
+javax.print.attribute.standard
+javax.print.event
+javax.rmi
+javax.rmi.CORBA
+javax.rmi.ssl
+javax.script
+javax.security.auth
+javax.security.auth.callback
+javax.security.auth.kerberos
+javax.security.auth.login
+javax.security.auth.spi
+javax.security.auth.x500
+javax.security.cert
+javax.security.sasl
+javax.smartcardio
+javax.sound.midi
+javax.sound.midi.spi
+javax.sound.sampled
+javax.sound.sampled.spi
+javax.sql
+javax.sql.rowset
+javax.sql.rowset.serial
+javax.sql.rowset.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
+javax.tools
+javax.transaction
+javax.transaction.xa
+javax.xml
+javax.xml.bind
+javax.xml.bind.annotation
+javax.xml.bind.annotation.adapters
+javax.xml.bind.attachment
+javax.xml.bind.helpers
+javax.xml.bind.util
+javax.xml.catalog
+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
+javax.xml.datatype
+javax.xml.namespace
+javax.xml.parsers
+javax.xml.soap
+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.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
+javax.xml.xpath
+jdk.dynalink
+jdk.dynalink.beans
+jdk.dynalink.linker
+jdk.dynalink.linker.support
+jdk.dynalink.support
+jdk.incubator.http
+jdk.javadoc.doclet
+jdk.jfr
+jdk.jfr.consumer
+jdk.jshell
+jdk.jshell.execution
+jdk.jshell.spi
+jdk.jshell.tool
+jdk.management.cmm
+jdk.management.jfr
+jdk.management.resource
+jdk.nashorn.api.scripting
+jdk.nashorn.api.tree
+jdk.net
+jdk.packager.services
+jdk.security.jarsigner
+netscape.javascript
+org.ietf.jgss
+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
+org.w3c.dom
+org.w3c.dom.bootstrap
+org.w3c.dom.css
+org.w3c.dom.events
+org.w3c.dom.html
+org.w3c.dom.ls
+org.w3c.dom.ranges
+org.w3c.dom.stylesheets
+org.w3c.dom.traversal
+org.w3c.dom.views
+org.w3c.dom.xpath
+org.xml.sax
+org.xml.sax.ext
+org.xml.sax.helpers
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 e54bf63..706b26e 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java
@@ -25,11 +25,15 @@
import java.io.IOException;
import java.util.List;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugins.javadoc.JavadocReport;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
+import org.sonatype.aether.util.DefaultRepositorySystemSession;
public class AggregatorJavadocReportTest
extends AbstractMojoTestCase
@@ -63,8 +67,16 @@
JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom );
MojoExecution mojoExec = new MojoExecution( new Plugin(), "aggregate", null );
-
setVariableValueToObject( mojo, "mojo", mojoExec );
+
+ MavenProject currentProject = new MavenProjectStub();
+ currentProject.setGroupId( "GROUPID" );
+ currentProject.setArtifactId( "ARTIFACTID" );
+
+ MavenSession session = newMavenSession( currentProject );
+ DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession();
+ repoSysSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) );
+ setVariableValueToObject( mojo, "session", session );
return mojo;
}
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 7c00ecc..9578f58 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
@@ -148,6 +148,13 @@
public void testFixJdk5()
throws Exception
{
+ // Should be an assumption, but not supported by TestCase
+ // Java 5 not supported by Java9 anymore
+ if ( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 )
+ {
+ return;
+ }
+
File testPomBasedir = new File( getBasedir(), "target/test/unit/fix-jdk5-test" );
executeMojoAndTest( testPomBasedir, new String[] { "ClassWithJavadoc.java", "ClassWithNoJavadoc.java",
"InterfaceWithJavadoc.java", "InterfaceWithNoJavadoc.java", "SubClassWithJavadoc.java" } );
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 ecff198..e066e47 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
@@ -32,9 +32,11 @@
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.plugins.javadoc.AbstractJavadocMojo;
import org.apache.maven.plugins.javadoc.JavadocJar;
import org.apache.maven.plugins.javadoc.JavadocVersion;
+import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
/**
@@ -53,6 +55,12 @@
setVariableValueToObject( mojo, "mojo", mojoExec );
+ MavenProject currentProject = new MavenProjectStub();
+ currentProject.setGroupId( "GROUPID" );
+ currentProject.setArtifactId( "ARTIFACTID" );
+
+ setVariableValueToObject( mojo, "session", newMavenSession( currentProject ) );
+
return mojo;
}
@@ -75,13 +83,16 @@
new File( getBasedir(), "target/test/unit/javadocjar-default/target/javadocjar-default-javadoc.jar" );
assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
- //validate contents of jar file
- ZipFile jar = new ZipFile( generatedFile );
Set<String> set = new HashSet<>();
- for( Enumeration<? extends ZipEntry> entries = jar.entries(); entries.hasMoreElements(); )
+
+ //validate contents of jar file
+ try ( ZipFile jar = new ZipFile( generatedFile ) )
{
- ZipEntry entry = entries.nextElement();
- set.add( entry.getName() );
+ for( Enumeration<? extends ZipEntry> entries = jar.entries(); entries.hasMoreElements(); )
+ {
+ ZipEntry entry = entries.nextElement();
+ set.add( entry.getName() );
+ }
}
assertTrue( set.contains( "stylesheet.css" ) );
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 96f88d3..19d6fa9 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
@@ -38,9 +38,9 @@
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugins.javadoc.JavadocReport;
-import org.apache.maven.plugins.javadoc.JavadocVersion;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.plugins.javadoc.ProxyServer.AuthAsyncProxyServlet;
+import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.apache.maven.settings.Proxy;
@@ -93,6 +93,12 @@
setVariableValueToObject( mojo, "mojo", mojoExec );
+ MavenProject currentProject = new MavenProjectStub();
+ currentProject.setGroupId( "GROUPID" );
+ currentProject.setArtifactId( "ARTIFACTID" );
+
+ setVariableValueToObject( mojo, "session", newMavenSession( currentProject ) );
+
return mojo;
}
@@ -297,6 +303,13 @@
public void testDocfiles()
throws Exception
{
+ // Should be an assumption, but not supported by TestCase
+ // Seems like a bug in Javadoc 9
+ if ( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) == 0 )
+ {
+ return;
+ }
+
File testPom = new File( unit, "docfiles-test/docfiles-test-plugin-config.xml" );
JavadocReport mojo = lookupMojo( testPom );
mojo.execute();
@@ -553,6 +566,13 @@
public void testJdk5()
throws Exception
{
+ // Should be an assumption, but not supported by TestCase
+ // Java 5 not supported by Java9 anymore
+ if ( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 )
+ {
+ return;
+ }
+
File testPom = new File( unit, "jdk5-test/jdk5-test-plugin-config.xml" );
JavadocReport mojo = lookupMojo( testPom );
mojo.execute();
@@ -631,7 +651,7 @@
assertTrue( content.contains( "<img src=\"doc-files/maven-feather.png\" alt=\"Maven\">" ) );
JavadocVersion javadocVersion = (JavadocVersion) getVariableValueFromObject( mojo, "javadocRuntimeVersion" );
- if( javadocVersion.compareTo( JavadocVersion.parse( "1.8" ) ) >= 0 && javadocVersion.compareTo( JavadocVersion.parse( "9" ) ) < 0)
+ if( javadocVersion.compareTo( JavadocVersion.parse( "1.8" ) ) >= 0 && javadocVersion.compareTo( JavadocVersion.parse( "10" ) ) < 0)
{
// https://bugs.openjdk.java.net/browse/JDK-8032205
assertTrue( "This bug appeared in JDK8 and was planned to be fixed in JDK9, see JDK-8032205",
@@ -641,6 +661,7 @@
{
assertFalse( new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() );
}
+ assertTrue( new File( apidocs, "resources/test2/doc-files/maven-feather.png" ).exists() );
app2 = new File( apidocs, "resources/test2/App2.html" );
assertTrue( app2.exists() );
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 8f8eb50..e13f176 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
@@ -25,9 +25,11 @@
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.regex.PatternSyntaxException;
import org.apache.commons.lang3.builder.EqualsBuilder;
@@ -585,10 +587,10 @@
list.add( getBasedir() + "/target/classes" );
list.add( getBasedir() + "/target/classes" );
- List<String> expected = new ArrayList<>();
- expected.add( getBasedir() + "/target/classes" );
+ String FS = System.getProperty( "file.separator" );
+ Set<String> expected = Collections.singleton( getBasedir() + FS +"target" + FS + "classes" );
- assertTrue( EqualsBuilder.reflectionEquals( expected, JavadocUtil.pruneDirs( null, list ) ) );
+ assertEquals( expected, JavadocUtil.pruneDirs( null, list ) );
}
/**
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java
index 740226b..7ada0da 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java
@@ -24,7 +24,8 @@
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugins.javadoc.TestJavadocReport;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
/**
@@ -49,11 +50,20 @@
MojoExecution mojoExec = new MojoExecution( new Plugin(), "test-javadoc", null );
setVariableValueToObject( mojo, "mojo", mojoExec );
+
+ MavenProject currentProject = new MavenProjectStub();
+ currentProject.setGroupId( "GROUPID" );
+ currentProject.setArtifactId( "ARTIFACTID" );
+ setVariableValueToObject( mojo, "session", newMavenSession( currentProject ) );
+
mojo.execute();
File generatedFile =
new File( getBasedir(), "target/test/unit/test-javadoc-test/target/site/apidocs/maven/AppTest.html" );
assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ File options = new File( getBasedir(), "target/test/unit/test-javadoc-test/target/site/apidocs/options");
+ FileUtils.fileRead( options ).contains( "junit-3.8.1.jar" );
}
}
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java
index def9961..68667ef 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java
@@ -22,6 +22,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Build;
@@ -39,9 +40,9 @@
{
readModel( new File( getBasedir(), "pom.xml" ) );
- setGroupId( getModel().getGroupId() );
+ setGroupId( Objects.toString( getModel().getGroupId(), getModel().getParent().getGroupId() ) );
setArtifactId( getModel().getArtifactId() );
- setVersion( getModel().getVersion() );
+ setVersion( Objects.toString( getModel().getVersion(), getModel().getParent().getVersion() ) );
setName( getModel().getName() );
setUrl( getModel().getUrl() );
setPackaging( getModel().getPackaging() );
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java
index 9283309..bbc5647 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java
@@ -22,6 +22,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Build;
@@ -39,9 +40,9 @@
{
readModel( new File( getBasedir(), "pom.xml" ) );
- setGroupId( getModel().getGroupId() );
+ setGroupId( Objects.toString( getModel().getGroupId(), getModel().getParent().getGroupId() ) );
setArtifactId( getModel().getArtifactId() );
- setVersion( getModel().getVersion() );
+ setVersion( Objects.toString( getModel().getVersion(), getModel().getParent().getVersion() ) );
setName( getModel().getName() );
setUrl( getModel().getUrl() );
setPackaging( getModel().getPackaging() );
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/TestJavadocMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/TestJavadocMavenProjectStub.java
index 6a422c2..c0f246c 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/TestJavadocMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/TestJavadocMavenProjectStub.java
@@ -23,6 +23,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
@@ -50,12 +51,6 @@
setUrl( getModel().getUrl() );
setPackaging( getModel().getPackaging() );
- Artifact junit = new DefaultArtifact( "junit", "junit", VersionRange.createFromVersion( "3.8.1" ),
- Artifact.SCOPE_TEST, "jar", null, new DefaultArtifactHandler( "jar" ),
- false );
- junit.setFile( new File( getBasedir() + "/junit/junit/3.8.1/junit-3.8.1.jar" ) );
- setTestArtifacts( Collections.singletonList( junit ) );
-
Build build = new Build();
build.setFinalName( getModel().getArtifactId() );
build.setDirectory( super.getBasedir() + "/target/test/unit/test-javadoc-test/target" );
@@ -87,4 +82,14 @@
{
return this;
}
+
+ @Override
+ public Set<Artifact> getArtifacts()
+ {
+ Artifact junit = new DefaultArtifact( "junit", "junit", VersionRange.createFromVersion( "3.8.1" ),
+ Artifact.SCOPE_TEST, "jar", null, new DefaultArtifactHandler( "jar" ),
+ false );
+ junit.setFile( new File( getBasedir() + "/junit/junit/3.8.1/junit-3.8.1.jar" ) );
+ return Collections.singleton( junit );
+ }
}