You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2015/12/07 19:27:36 UTC
svn commit: r1718436 - in /maven/plugins/trunk/maven-javadoc-plugin: ./
src/it/MJAVADOC-437/ src/it/MJAVADOC-437/module1/
src/it/MJAVADOC-437/module1/src/ src/it/MJAVADOC-437/module1/src/main/
src/it/MJAVADOC-437/module1/src/main/java/ src/it/MJAVADOC-...
Author: michaelo
Date: Mon Dec 7 18:27:36 2015
New Revision: 1718436
URL: http://svn.apache.org/viewvc?rev=1718436&view=rev
Log:
[MJAVADOC-437] javadoc:aggregate fails on initial build
Contributed by: Harald Wellmann <ha...@gmx.de>
Added:
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/invoker.properties
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/pom.xml
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/example/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/example/foo/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/example/foo/Foo.java
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/pom.xml
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/example/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/example/bar/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/example/bar/Bar.java
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/pom.xml
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/verify.bsh
Modified:
maven/plugins/trunk/maven-javadoc-plugin/pom.xml
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/pom.xml?rev=1718436&r1=1718435&r2=1718436&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/pom.xml Mon Dec 7 18:27:36 2015
@@ -405,6 +405,7 @@ under the License.
<pomInclude>MJAVADOC-369/pom.xml</pomInclude>
<pomInclude>MJAVADOC-407/pom.xml</pomInclude>
<pomInclude>MJAVADOC-414/pom.xml</pomInclude>
+ <pomInclude>MJAVADOC-437/pom.xml</pomInclude>
</pomIncludes>
</configuration>
</plugin>
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/invoker.properties?rev=1718436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/invoker.properties (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/invoker.properties Mon Dec 7 18:27:36 2015
@@ -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.goals=clean javadoc:aggregate
+
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/pom.xml?rev=1718436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/pom.xml Mon Dec 7 18:27:36 2015
@@ -0,0 +1,36 @@
+<?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.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc437</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc437-module1</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test MJAVADOC-437 Module 1</name>
+
+</project>
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/example/foo/Foo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/example/foo/Foo.java?rev=1718436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/example/foo/Foo.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module1/src/main/java/com/example/foo/Foo.java Mon Dec 7 18:27:36 2015
@@ -0,0 +1,33 @@
+package com.example.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.
+ */
+
+/**
+ * This is a Foo.
+ */
+public class Foo
+{
+ /**
+ * Frobnicates the foo.
+ */
+ public void frobnicate()
+ {
+ }
+}
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/pom.xml?rev=1718436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/pom.xml Mon Dec 7 18:27:36 2015
@@ -0,0 +1,50 @@
+<?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.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc437</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc437-module2</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test MJAVADOC-437 Module 2</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc437-module1</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- This is just some external dependency to trigger the bug -->
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/example/bar/Bar.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/example/bar/Bar.java?rev=1718436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/example/bar/Bar.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/module2/src/main/java/com/example/bar/Bar.java Mon Dec 7 18:27:36 2015
@@ -0,0 +1,50 @@
+package com.example.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.
+ */
+
+import org.apache.commons.io.ByteOrderMark;
+
+/**
+ * This is a Bar.
+ */
+public class Bar
+{
+ /**
+ * Glibbifies the bar.
+ * <p>
+ * NOTE: The parameter using an external dependency is essential to
+ * make the test fail with maven-javadoc-plugin 2.10.3.
+ * </p>
+ * <p>
+ * If one dependency fails to be resolved (the one on module1), all
+ * dependencies of the current module will be skipped.
+ * </p>
+ * <p>
+ * As a result, in the generated Javadoc, ByteOrderMark will be missing
+ * the package prefix.
+ * </p>
+ *
+ * @param bom byte order mark
+ */
+ public void glibbify(ByteOrderMark bom)
+ {
+ // empty
+ }
+}
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/pom.xml?rev=1718436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/pom.xml Mon Dec 7 18:27:36 2015
@@ -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>
+
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc437</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test MJAVADOC-437</name>
+
+ <modules>
+ <module>module1</module>
+ <module>module2</module>
+ </modules>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@pom.version@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/verify.bsh?rev=1718436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/verify.bsh (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-437/verify.bsh Mon Dec 7 18:27:36 2015
@@ -0,0 +1,69 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+
+// In JDK 7, javadoc terminates with exit code 0 even when there are errors.
+// To find an error, we either have to parse the build.log generated by
+// maven-invoker-plugin, or look at the generated HTML files.
+// The latter is approach is more stable, as it does not depend on a given
+// javadoc version or the error message formatting.
+// Our module2 has a dependency on commons-io, and class Bar has a parameter
+// of type org.apache.commons.io.ByteOrderMark. In the generated Javadoc,
+// this parameter type should occur with its fully qualified name.
+// If the package prefix is missing, we know that maven-javadoc-plugin
+// failed to resolve the classpath dependencies.
+
+boolean result = true;
+
+try
+{
+ File javadoc = new File( basedir, "target/site/apidocs/com/example/bar/Bar.html" );
+ if ( !javadoc.exists() )
+ {
+ System.err.println( javadoc + " is missing" );
+ return false;
+ }
+
+ FileReader fr = new FileReader( javadoc );
+ BufferedReader br = new BufferedReader( fr );
+ String line;
+ while ( ( line = br.readLine() ) != null )
+ {
+ if ( line.contains( "org.apache.commons.io" ) )
+ {
+ result = true;
+ break;
+ }
+ }
+ br.close();
+ if ( !result )
+ {
+ System.err.println( "package name org.apache.commons.io not found" );
+ }
+ return result;
+}
+catch ( Exception e )
+{
+ e.printStackTrace();
+ return false;
+}
+
+return result;
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=1718436&r1=1718435&r2=1718436&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java Mon Dec 7 18:27:36 2015
@@ -2501,7 +2501,9 @@ public abstract class AbstractJavadocMoj
/**
* Method that sets the classpath elements that will be specified in the javadoc <code>-classpath</code>
- * parameter.
+ * parameter. Since we have all the sources of the current reactor, it is sufficient to consider the
+ * dependencies of the reactor modules, excluding the module artifacts which may not yet be available
+ * when the reactor project is built for the first time.
*
* @return a String that contains the concatenated classpath elements, separated by the System pathSeparator
* string (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
@@ -2523,6 +2525,11 @@ public abstract class AbstractJavadocMoj
if ( isAggregator() && project.isExecutionRoot() )
{
+ List<Artifact> reactorArtifacts = new ArrayList<Artifact>();
+ for ( MavenProject p : reactorProjects )
+ {
+ reactorArtifacts.add( p.getArtifact() );
+ }
try
{
for ( MavenProject subProject : reactorProjects )
@@ -2532,6 +2539,8 @@ public abstract class AbstractJavadocMoj
classpathElements.addAll( getProjectBuildOutputDirs( subProject ) );
Set<Artifact> dependencyArtifacts = subProject.createArtifacts( factory, null, null );
+ // do not attempt to resolve artifacts of the current reactor which may not exist yet
+ dependencyArtifacts.removeAll( reactorArtifacts );
if ( !dependencyArtifacts.isEmpty() )
{
ArtifactResolutionResult result = null;