You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/01/06 15:04:50 UTC

[maven-javadoc-plugin] branch MJAVADOC-555 updated (3abdbbc -> 2617b6b)

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

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


    from 3abdbbc  Test with JDK12 too
     add 34fccfb  [MJAVADOC-527] detectLinks may pass invalid URLs to javadoc(1)
     new 444831a  [MJAVADOC-555] Javadoc:aggregate, Javadoc:jar fail if one of the modules does not contain module-info.java
     new 5f58982  [MJAVADOC-555] Javadoc:aggregate, Javadoc:jar fail if one of the modules does not contain module-info.java Testcase 2: link with automatic module
     new 7c8f9c4  Test with JDK12 too
     new 2617b6b  Merge branch 'MJAVADOC-555' of https://gitbox.apache.org/repos/asf/maven-javadoc-plugin into MJAVADOC-555

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/maven/plugins/javadoc/JavadocUtil.java  | 63 ++++++++++++++--------
 .../plugins/javadoc/AbstractJavadocMojoTest.java   | 15 +++++-
 2 files changed, 53 insertions(+), 25 deletions(-)


[maven-javadoc-plugin] 01/04: [MJAVADOC-555] Javadoc:aggregate, Javadoc:jar fail if one of the modules does not contain module-info.java

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 444831a552835c60341bb4f856822e9daa821060
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 4 16:28:47 2019 +0100

    [MJAVADOC-555] Javadoc:aggregate, Javadoc:jar fail if one of the modules does not contain module-info.java
---
 .../MJAVADOC-555_aggr_mixed/invoker.properties     |  19 +++
 .../MJAVADOC-555_aggr_mixed/module1/pom.xml        |  32 ++++
 .../module1/src/main/java/module-info.java         |  23 +++
 .../module1/src/main/java/module1/Main.java        |  24 +++
 .../MJAVADOC-555_aggr_mixed/module2/pom.xml        |  52 +++++++
 .../module2/src/main/java/module2/Main.java        |  24 +++
 src/it/projects/MJAVADOC-555_aggr_mixed/pom.xml    |  69 +++++++++
 .../projects/MJAVADOC-555_aggr_mixed/verify.groovy |  38 +++++
 .../maven/plugins/javadoc/AbstractJavadocMojo.java | 168 ++++++++++++++++++---
 9 files changed, 431 insertions(+), 18 deletions(-)

diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/invoker.properties b/src/it/projects/MJAVADOC-555_aggr_mixed/invoker.properties
new file mode 100644
index 0000000..768d035
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/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= package javadoc:aggregate
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/module1/pom.xml b/src/it/projects/MJAVADOC-555_aggr_mixed/module1/pom.xml
new file mode 100644
index 0000000..288012b
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/module1/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">
+    <modelVersion>4.0.0</modelVersion>
+	<parent>
+		<artifactId>javadoc-maven-report-exception</artifactId>
+		<groupId>testcase</groupId>
+		<version>1.0-SNAPSHOT</version>
+	</parent>
+	<artifactId>module1</artifactId>
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/module1/src/main/java/module-info.java b/src/it/projects/MJAVADOC-555_aggr_mixed/module1/src/main/java/module-info.java
new file mode 100644
index 0000000..0dd7ad2
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/module1/src/main/java/module-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+module module1
+{
+	exports module1;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/module1/src/main/java/module1/Main.java b/src/it/projects/MJAVADOC-555_aggr_mixed/module1/src/main/java/module1/Main.java
new file mode 100644
index 0000000..e60dbdb
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/module1/src/main/java/module1/Main.java
@@ -0,0 +1,24 @@
+package module1;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public final class Main
+{
+}
diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/module2/pom.xml b/src/it/projects/MJAVADOC-555_aggr_mixed/module2/pom.xml
new file mode 100644
index 0000000..bc44c23
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/module2/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>javadoc-maven-report-exception</artifactId>
+    <groupId>testcase</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>module2</artifactId>
+  
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>2.3.2</version>
+          <configuration>
+            <archive>
+              <manifestEntries>
+                <Automatic-Module-Name>module2</Automatic-Module-Name>
+              </manifestEntries>
+            </archive>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/module2/src/main/java/module2/Main.java b/src/it/projects/MJAVADOC-555_aggr_mixed/module2/src/main/java/module2/Main.java
new file mode 100644
index 0000000..b864f0e
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/module2/src/main/java/module2/Main.java
@@ -0,0 +1,24 @@
+package module2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public final class Main
+{
+}
diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/pom.xml b/src/it/projects/MJAVADOC-555_aggr_mixed/pom.xml
new file mode 100644
index 0000000..c881914
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/pom.xml
@@ -0,0 +1,69 @@
+<?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>
+
+  <artifactId>javadoc-maven-report-exception</artifactId>
+  <groupId>testcase</groupId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  
+  <url>https://issues.apache.org/jira/browse/MJAVADOC-555</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.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>aggregate</id>
+            <goals>
+              <goal>aggregate</goal>
+            </goals>
+            <phase>site</phase>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <modules>
+    <module>module1</module>
+    <module>module2</module>
+  </modules>
+
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_aggr_mixed/verify.groovy b/src/it/projects/MJAVADOC-555_aggr_mixed/verify.groovy
new file mode 100644
index 0000000..e75b96c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_aggr_mixed/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="module1\/module-summary\.html">module1<\/a>/
+	assert index.text =~ /<a href="module2\/module-summary\.html">module2<\/a>/
+	
+	assert new File( basedir, 'target/site/apidocs/module1/module-summary.html').exists()
+	assert new File( basedir, 'target/site/apidocs/module2/module-summary.html').exists()
+} 
+else {
+    def overview = new File( basedir, 'target/site/apidocs/overview-summary.html')
+
+	assert overview.text =~ /<a href="module1-summary.html">module1<\/a>/
+	assert overview.text =~ /<a href="module2-summary.html">module2<\/a>/
+	
+	assert new File( basedir, 'target/site/apidocs/module1-summary.html').exists()
+	assert new File( basedir, 'target/site/apidocs/module2-summary.html').exists()
+} 
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 a068b74..e6cea07 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -84,6 +84,7 @@ import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
 import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
 import org.codehaus.plexus.languages.java.jpms.LocationManager;
+import org.codehaus.plexus.languages.java.jpms.ResolvePathRequest;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
 import org.codehaus.plexus.languages.java.version.JavaVersion;
@@ -1822,6 +1823,15 @@ public abstract class AbstractJavadocMojo
 
         return Collections.singletonList( new File( p.getBuild().getOutputDirectory() ) );
     }
+    
+    protected File getArtifactFile( MavenProject project )
+    {
+        if ( project.getArtifact() != null )
+        {
+            return project.getArtifact().getFile();
+        }
+        return null;
+    }
 
     /**
      * @param p not null maven project
@@ -2025,7 +2035,6 @@ public abstract class AbstractJavadocMojo
         {
             packageNames = getPackageNames( files );
         }
-        List<String> filesWithUnnamedPackages = getFilesWithUnnamedPackages( files );
 
         // ----------------------------------------------------------------------
         // Javadoc output directory as File
@@ -2128,9 +2137,11 @@ public abstract class AbstractJavadocMojo
             // Write argfile file and include it in the command line
             // ----------------------------------------------------------------------
 
-            if ( !filesWithUnnamedPackages.isEmpty() )
+            List<String> specialFiles = getSpecialFiles( files );
+
+            if ( !specialFiles.isEmpty() )
             {
-                addCommandLineArgFile( cmd, javadocOutputDirectory, filesWithUnnamedPackages );
+                addCommandLineArgFile( cmd, javadocOutputDirectory, specialFiles );
             }
         }
         else
@@ -2689,7 +2700,15 @@ public abstract class AbstractJavadocMojo
             {
                 if ( subProject != project )
                 {
-                    classpathElements.addAll( getProjectBuildOutputDirs( subProject ) );
+                    File projectArtifactFile = getArtifactFile( subProject );
+                    if ( projectArtifactFile != null )
+                    {
+                        classpathElements.add( projectArtifactFile );
+                    }
+                    else
+                    {
+                        classpathElements.addAll( getProjectBuildOutputDirs( subProject ) );
+                    }
 
                     try
                     {
@@ -4515,6 +4534,70 @@ public abstract class AbstractJavadocMojo
         
         return returnList;
     }
+    
+    /**
+     * Either return only the module descriptor or all sourcefiles per sourcepath
+     * @param sourcePaths could be null
+     * @param files       not null
+     * @return a list of files
+     */
+    private List<String> getSpecialFiles( Map<Path, Collection<String>> sourcePaths )
+    {
+        if ( !StringUtils.isEmpty( sourcepath ) )
+        {
+            return new ArrayList<>();
+        }
+        
+        boolean containsModuleDescriptor = false;
+        for ( Collection<String> sourcepathFiles : sourcePaths.values() )
+        {
+            containsModuleDescriptor = sourcepathFiles.contains( "module-info.java" );
+            if ( containsModuleDescriptor )
+            {
+                break;
+            }
+        }
+        
+        if ( containsModuleDescriptor )
+        {
+            return getModuleSourcePathFiles( sourcePaths );
+        }
+        else
+        {
+            return getFilesWithUnnamedPackages( sourcePaths );
+        }
+    }
+
+    private List<String> getModuleSourcePathFiles( Map<Path, Collection<String>> sourcePaths )
+    {
+        List<String> returnList = new ArrayList<>();
+        
+        for ( Entry<Path, Collection<String>> currentPathEntry : sourcePaths.entrySet() )
+        {
+            Path currentSourcePath = currentPathEntry.getKey();
+            if ( currentPathEntry.getValue().contains( "module-info.java" ) )
+            {
+                returnList.add( currentSourcePath.resolve( "module-info.java" ).toAbsolutePath().toString() );
+            }
+            else
+            {
+                for ( String currentFile : currentPathEntry.getValue() )
+                {
+                    /*
+                     * Remove the miscellaneous files
+                     * http://docs.oracle.com/javase/1.4.2/docs/tooldocs/solaris/javadoc.html#unprocessed
+                     */
+                    if ( currentFile.contains( "doc-files" ) )
+                    {
+                        continue;
+                    }
+            
+                    returnList.add( currentSourcePath.resolve( currentFile ).toAbsolutePath().toString() );
+                }
+            }
+        }
+        return returnList;
+    }
 
     /**
      * Generate an <code>options</code> file for all options and arguments and add the <code>@options</code> in the
@@ -4822,37 +4905,86 @@ public abstract class AbstractJavadocMojo
             addArgIf( arguments, breakiterator, "-breakiterator", SINCE_JAVADOC_1_5 );
         }
         
-        Collection<String> reactorKeys = new HashSet<>( session.getProjects().size() );
+        Map<String, MavenProject> reactorKeys = new HashMap<>( session.getProjects().size() );
         for ( MavenProject reactorProject : session.getProjects() )
         {
-            reactorKeys.add( ArtifactUtils.versionlessKey( reactorProject.getGroupId(),
-                                                           reactorProject.getArtifactId() ) );
+            reactorKeys.put( ArtifactUtils.versionlessKey( reactorProject.getGroupId(),
+                                                           reactorProject.getArtifactId() ), reactorProject );
         }
         
         final LocationManager locationManager = new LocationManager();
         
         Collection<String> additionalModules = new ArrayList<>();
         
+        boolean containsModuleDescriptor = false;
+        for ( Collection<Path> sourcepaths : allSourcePaths.values() )
+        {
+            if ( findMainDescriptor( sourcepaths ) != null )
+            {
+                containsModuleDescriptor = true;
+            }
+        }
+        
+        
         Path moduleSourceDir = null;
-        if ( allSourcePaths.size() > 1 )
+        if ( containsModuleDescriptor && allSourcePaths.size() > 1 )
         {
             for ( Map.Entry<String, Collection<Path>> projectSourcepaths : allSourcePaths.entrySet() )
             {
-                if ( reactorKeys.contains( projectSourcepaths.getKey() ) )
+                MavenProject aggregatorProject = reactorKeys.get( projectSourcepaths.getKey() );
+                if ( aggregatorProject != null )
                 {
-                    File moduleDescriptor = findMainDescriptor( projectSourcepaths.getValue() );
-                    if ( moduleDescriptor != null )
+                    String moduleName = null;
+                    
+                    // Prefer jar over outputDirectory, since it may may contain an automatic module name
+                    File artifactFile = getArtifactFile( aggregatorProject );
+                    if ( artifactFile != null ) 
+                    {
+                        ResolvePathRequest<File> request = ResolvePathRequest.ofFile( artifactFile );
+                        try
+                        {
+                            moduleName = locationManager.resolvePath( request ).getModuleDescriptor().name();
+                        }
+                        catch ( RuntimeException e )
+                        {
+                            // most likely an invalid module name based on filename
+                            if ( !"java.lang.module.FindException".equals( e.getClass().getName() ) )
+                            {
+                                throw e;
+                            }
+                        }
+                        catch ( IOException e )
+                        {
+                            throw new MavenReportException( e.getMessage(), e );
+                        }
+                    }
+                    else
+                    {
+                        File moduleDescriptor = findMainDescriptor( projectSourcepaths.getValue() );
+                        
+                        if ( moduleDescriptor != null )
+                        {
+                            ResolvePathsRequest<File> request =
+                                            ResolvePathsRequest.ofFiles( Collections.<File>emptyList() )
+                                                               .setMainModuleDescriptor( moduleDescriptor );
+
+                            try
+                            {
+                                moduleName =
+                                    locationManager.resolvePaths( request ).getMainModuleDescriptor().name();
+                            }
+                            catch ( IOException e )
+                            {
+                                throw new MavenReportException( e.getMessage(), e );
+                            }
+                        }
+                    }
+                    if ( moduleName != 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();
                             
                             additionalModules.add( moduleName );
                             
@@ -4896,7 +5028,7 @@ public abstract class AbstractJavadocMojo
         if ( javadocRuntimeVersion.isAtLeast( "9" ) && ( isAggregator() || mainDescriptor != null ) && !isTest() )
         {
             ResolvePathsRequest<File> request =
-                ResolvePathsRequest.withFiles( getPathElements() ).setAdditionalModules( additionalModules );
+                ResolvePathsRequest.ofFiles( getPathElements() ).setAdditionalModules( additionalModules );
             
             if ( mainDescriptor != null )
             {


[maven-javadoc-plugin] 02/04: [MJAVADOC-555] Javadoc:aggregate, Javadoc:jar fail if one of the modules does not contain module-info.java Testcase 2: link with automatic module

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5f58982fa2458c2cde5eb305feda9cc4efa0911a
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 4 21:28:01 2019 +0100

    [MJAVADOC-555] Javadoc:aggregate, Javadoc:jar fail if one of the modules does not contain module-info.java
    Testcase 2: link with automatic module
---
 .../invoker.properties                             | 19 ++++++
 .../MJAVADOC-555_link-automatic-modules/pom.xml    | 75 ++++++++++++++++++++++
 .../src/main/java/com/testcase/Testcase.java       | 30 +++++++++
 .../src/main/java/module-info.java                 | 22 +++++++
 .../verify.groovy                                  | 33 ++++++++++
 5 files changed, 179 insertions(+)

diff --git a/src/it/projects/MJAVADOC-555_link-automatic-modules/invoker.properties b/src/it/projects/MJAVADOC-555_link-automatic-modules/invoker.properties
new file mode 100644
index 0000000..d47ff2a
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_link-automatic-modules/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= package
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_link-automatic-modules/pom.xml b/src/it/projects/MJAVADOC-555_link-automatic-modules/pom.xml
new file mode 100644
index 0000000..6c5522c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_link-automatic-modules/pom.xml
@@ -0,0 +1,75 @@
+<?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>testcase</groupId>
+  <artifactId>javadoc-cannot-link-to-automatic-modules</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <url>https://issues.apache.org/jira/browse/MJAVADOC-555</url>
+  
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <guava.version>27.0.1-jre</guava.version>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.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>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+            <configuration>
+              <links>
+                <link>https://google.github.io/guava/releases/${guava.version}/api/docs/</link>
+              </links>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>${guava.version}</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_link-automatic-modules/src/main/java/com/testcase/Testcase.java b/src/it/projects/MJAVADOC-555_link-automatic-modules/src/main/java/com/testcase/Testcase.java
new file mode 100644
index 0000000..0dedddd
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_link-automatic-modules/src/main/java/com/testcase/Testcase.java
@@ -0,0 +1,30 @@
+package com.testcase;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.google.common.collect.Multimap;
+
+public class Testcase
+{
+	public Multimap<String, String> test()
+	{
+		return null;
+	}
+}
diff --git a/src/it/projects/MJAVADOC-555_link-automatic-modules/src/main/java/module-info.java b/src/it/projects/MJAVADOC-555_link-automatic-modules/src/main/java/module-info.java
new file mode 100644
index 0000000..05a60d9
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_link-automatic-modules/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 jul_to_slf4j
+{
+	requires com.google.common;
+}
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-555_link-automatic-modules/verify.groovy b/src/it/projects/MJAVADOC-555_link-automatic-modules/verify.groovy
new file mode 100644
index 0000000..df3df50
--- /dev/null
+++ b/src/it/projects/MJAVADOC-555_link-automatic-modules/verify.groovy
@@ -0,0 +1,33 @@
+/*
+ * 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 classFile 
+int javaVersion = System.getProperty( "java.specification.version" ) as Integer
+if ( javaVersion >= 11 ) {
+ classFile = new File( basedir, 'target/apidocs/jul_to_slf4j/com/testcase/Testcase.html')
+} else {
+ classFile = new File( basedir, 'target/apidocs/com/testcase/Testcase.html')
+}
+
+def p = /<a href="([^"]+)"(?:[^>]+)>Multimap<\/a>/
+
+def m = classFile.text =~ p
+
+assert m.hasGroup()
+assert m[0][1] == "https://google.github.io/guava/releases/27.0.1-jre/api/docs/com/google/common/collect/Multimap.html?is-external=true" 


[maven-javadoc-plugin] 04/04: Merge branch 'MJAVADOC-555' of https://gitbox.apache.org/repos/asf/maven-javadoc-plugin into MJAVADOC-555

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2617b6bfb0edc6db8613ea968095530ffa117b22
Merge: 7c8f9c4 3abdbbc
Author: rfscholte <rf...@apache.org>
AuthorDate: Sun Jan 6 16:04:38 2019 +0100

    Merge branch 'MJAVADOC-555' of https://gitbox.apache.org/repos/asf/maven-javadoc-plugin into MJAVADOC-555



[maven-javadoc-plugin] 03/04: Test with JDK12 too

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7c8f9c4430ffeda41b28ba749ac22915a00b07b6
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 4 22:10:51 2019 +0100

    Test with JDK12 too
---
 Jenkinsfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index e9f05f7..9d96ed0 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-asfMavenTlpPlgnBuild()
+asfMavenTlpPlgnBuild(jdk:['7','8','11','12'])