Author: rfscholte Date: Sun Oct 29 08:16:59 2017 New Revision: 1813672 URL: http://svn.apache.org/viewvc?rev=1813672&view=rev Log: [MJAVADOC-498] "module not found" when Java 9 module-info present Also adjust ITs to run with Java9
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/invoker.properties maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/pom.xml maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/com/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/com/foo/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/com/foo/MyClass.java maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/module-info.java maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/com/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/com/foo/ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/com/foo/MyTest.java maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/verify.groovy Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml maven/plugins/trunk/maven-javadoc-plugin/src/it/additional-dependencies/pom.xml maven/plugins/trunk/maven-javadoc-plugin/src/it/javadoc-fix/pom.xml maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/fix-test/pom.xml Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/pom.xml?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-javadoc-plugin/pom.xml Sun Oct 29 08:16:59 2017 @@ -222,6 +222,11 @@ under the License. <!-- Plexus --> <dependency> <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-java</artifactId> + <version>0.9.4</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-archiver</artifactId> <version>3.4</version> </dependency> @@ -325,6 +330,31 @@ under the License. </pluginManagement> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-bytecode-version</id> + <configuration> + <rules> + <enforceBytecodeVersion> + <ignoreClasses> + <ignoreClass>module-info</ignoreClass> + </ignoreClasses> + </enforceBytecodeVersion> + </rules> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.codehaus.mojo</groupId> + <artifactId>extra-enforcer-rules</artifactId> + <version>1.0-beta-6</version> + </dependency> + </dependencies> + </plugin> + <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> <executions> @@ -385,6 +415,10 @@ under the License. <pomExclude>MJAVADOC-181/pom.xml</pomExclude> <!-- seems to be wrong, see comment in Jira issue --> <pomExclude>output-encoding/pom.xml</pomExclude> </pomExcludes> + <properties> + <maven.compiler.source>${maven.compiler.source}</maven.compiler.source> + <maven.compiler.target>${maven.compiler.target}</maven.compiler.target> + </properties> </configuration> </plugin> </plugins> @@ -449,27 +483,6 @@ under the License. </plugin> </plugins> </build> - </profile> - <profile> - <id>java9</id> - <activation> - <jdk>[9,)</jdk> - </activation> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-metadata</artifactId> - <dependencies> - <dependency> - <groupId>org.ow2.asm</groupId> - <artifactId>asm-all</artifactId> - <version>6.0_ALPHA</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> </profile> </profiles> </project> Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml Sun Oct 29 08:16:59 2017 @@ -33,6 +33,8 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.4</maven.compiler.source> + <maven.compiler.target>1.4</maven.compiler.target> </properties> <build> @@ -50,10 +52,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> - <configuration> - <source>1.4</source> - <target>1.4</target> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/invoker.properties?rev=1813672&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/invoker.properties (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/invoker.properties Sun Oct 29 08:16:59 2017 @@ -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 = 1.9+ Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/pom.xml?rev=1813672&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/pom.xml (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/pom.xml Sun Oct 29 08:16:59 2017 @@ -0,0 +1,77 @@ +<?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> + + <url>https://issues.apache.org/jira/browse/MJAVADOC-489</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.6</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <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></id> + <goals> + <goal>jar</goal> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/com/foo/MyClass.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/com/foo/MyClass.java?rev=1813672&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/com/foo/MyClass.java (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/com/foo/MyClass.java Sun Oct 29 08:16:59 2017 @@ -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 +{ + +} Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/module-info.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/module-info.java?rev=1813672&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/module-info.java (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/main/java/module-info.java Sun Oct 29 08:16:59 2017 @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +module M.N { + requires org.apache.commons.lang3; +} \ No newline at end of file Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/com/foo/MyTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/com/foo/MyTest.java?rev=1813672&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/com/foo/MyTest.java (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/src/test/java/com/foo/MyTest.java Sun Oct 29 08:16:59 2017 @@ -0,0 +1,35 @@ +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. + */ + +import static org.junit.Assert.assertNotNull; +import org.junit.Test; + +public class MyTest +{ + private MyClass myClass = new MyClass(); + + @Test + public void testClass() throws Exception + { + assertNotNull( myClass ); + } + +} Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/verify.groovy?rev=1813672&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/verify.groovy (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-498_modulepath/verify.groovy Sun Oct 29 08:16:59 2017 @@ -0,0 +1,21 @@ +/* + * 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 log = new File( basedir, 'build.log').text + +assert log.count( " --module-path" ) == 2 Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/additional-dependencies/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/additional-dependencies/pom.xml?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/additional-dependencies/pom.xml (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/additional-dependencies/pom.xml Sun Oct 29 08:16:59 2017 @@ -33,6 +33,8 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.5</maven.compiler.source> + <maven.compiler.target>1.5</maven.compiler.target> </properties> <build> @@ -41,10 +43,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/javadoc-fix/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/javadoc-fix/pom.xml?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/it/javadoc-fix/pom.xml (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/it/javadoc-fix/pom.xml Sun Oct 29 08:16:59 2017 @@ -29,6 +29,8 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.4</maven.compiler.source> + <maven.compiler.target>1.4</maven.compiler.target> </properties> <build> @@ -43,10 +45,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> - <configuration> - <source>1.4</source> - <target>1.4</target> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java Sun Oct 29 08:16:59 2017 @@ -74,6 +74,8 @@ import org.apache.maven.plugin.AbstractM import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.javadoc.options.BootclasspathArtifact; import org.apache.maven.plugins.javadoc.options.DocletArtifact; import org.apache.maven.plugins.javadoc.options.Group; @@ -85,8 +87,6 @@ import org.apache.maven.plugins.javadoc. import org.apache.maven.plugins.javadoc.options.Taglet; import org.apache.maven.plugins.javadoc.options.TagletArtifact; import org.apache.maven.plugins.javadoc.options.io.xpp3.JavadocOptionsXpp3Writer; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.javadoc.resolver.JavadocBundle; import org.apache.maven.plugins.javadoc.resolver.ResourceResolver; import org.apache.maven.plugins.javadoc.resolver.SourceResolverConfig; @@ -117,6 +117,9 @@ import org.codehaus.plexus.archiver.UnAr import org.codehaus.plexus.archiver.manager.ArchiverManager; import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector; +import org.codehaus.plexus.languages.java.jpms.LocationManager; +import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest; +import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; @@ -4577,8 +4580,35 @@ public abstract class AbstractJavadocMoj addArgIf( arguments, breakiterator, "-breakiterator", SINCE_JAVADOC_1_5 ); } - String classpath = StringUtils.join( getPathElements().iterator(), File.pathSeparator ); - addArgIfNotEmpty( arguments, "-classpath", JavadocUtil.quotedPathArgument( classpath ) ); + File mainDescriptor = new File( "src/main/java/module-info.java" ); + + if ( mainDescriptor.exists() && !isTest() ) + { + LocationManager locationManager = new LocationManager(); + ResolvePathsRequest<File> request = + ResolvePathsRequest.withFiles( getPathElements() ).setMainModuleDescriptor( mainDescriptor ); + try + { + ResolvePathsResult<File> result = locationManager.resolvePaths( request ); + + String classpath = StringUtils.join( result.getClasspathElements().iterator(), File.pathSeparator ); + addArgIfNotEmpty( arguments, "--class-path", JavadocUtil.quotedPathArgument( classpath ) ); + + String modulepath = + StringUtils.join( result.getModulepathElements().keySet().iterator(), File.pathSeparator ); + getLog().info( "modulepath: " + modulepath ); + addArgIfNotEmpty( arguments, "--module-path", JavadocUtil.quotedPathArgument( modulepath ) ); + } + catch ( IOException e ) + { + throw new MavenReportException( e.getMessage(), e ); + } + } + else + { + String classpath = StringUtils.join( getPathElements().iterator(), File.pathSeparator ); + addArgIfNotEmpty( arguments, "-classpath", JavadocUtil.quotedPathArgument( classpath ) ); + } if ( StringUtils.isNotEmpty( doclet ) ) { Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java Sun Oct 29 08:16:59 2017 @@ -780,12 +780,22 @@ public class JavadocUtil } else { - cl = new URLClassLoader( new URL[] { jarFile.toURI().toURL() }, null ); + cl = new URLClassLoader( new URL[] { jarFile.toURI().toURL() }, ClassLoader.getSystemClassLoader() ); } List<String> tagletClasses = new ArrayList<>(); - Class<?> tagletClass = cl.loadClass( "com.sun.tools.doclets.Taglet" ); + Class<?> tagletClass; + + try + { + tagletClass = cl.loadClass( "com.sun.tools.doclets.Taglet" ); + } + catch ( ClassNotFoundException e ) + { + tagletClass = cl.loadClass( "jdk.javadoc.doclet.Taglet" ); + } + for ( String s : classes ) { Class<?> c = cl.loadClass( s ); Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java Sun Oct 29 08:16:59 2017 @@ -26,7 +26,9 @@ import java.io.StringReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Properties; +import org.apache.commons.lang3.SystemUtils; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; @@ -639,7 +641,18 @@ public class FixJavadocMojoTest File invokerDir = new File( getBasedir(), "target/invoker" ); invokerDir.mkdirs(); File invokerLogFile = FileUtils.createTempFile( "FixJavadocMojoTest", ".txt", invokerDir ); - JavadocUtil.invokeMaven( log, new File( getBasedir(), "target/local-repo" ), testPom, goals, null, + + JavadocVersion JAVA_9 = JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ); + + Properties properties = new Properties(); + + if( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JAVA_9 ) >= 0 ) + { + properties.put( "maven.compiler.source", "1.6" ); + properties.put( "maven.compiler.target", "1.6" ); + } + + JavadocUtil.invokeMaven( log, new File( getBasedir(), "target/local-repo" ), testPom, goals, properties, invokerLogFile ); } Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/fix-test/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/fix-test/pom.xml?rev=1813672&r1=1813671&r2=1813672&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/fix-test/pom.xml (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/fix-test/pom.xml Sun Oct 29 08:16:59 2017 @@ -25,6 +25,11 @@ <version>1.1-SNAPSHOT</version> <name>Javadoc Test Project</name> <packaging>jar</packaging> + + <properties> + <maven.compiler.source>1.4</maven.compiler.source> + <maven.compiler.target>1.4</maven.compiler.target> + </properties> <build> <plugins> @@ -32,10 +37,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> - <configuration> - <source>1.4</source> - <target>1.4</target> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId>