diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/invoker.properties b/maven-javadoc-plugin/src/it/MJAVADOC-497/invoker.properties new file mode 100644 index 0000000000..3f0a694c09 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/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.goals=clean javadoc:aggregate + diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/pom.xml b/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/pom.xml new file mode 100644 index 0000000000..2e3efe4ed9 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + + org.apache.maven.plugins.maven-javadoc-plugin.it + mjavadoc497 + 1.0-SNAPSHOT + + + org.apache.maven.plugins.maven-javadoc-plugin.it + mjavadoc497-module1 + 1.0-SNAPSHOT + Test MJAVADOC-497 Module 1 + + diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/src/main/java/com/example/foo/Foo.java b/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/src/main/java/com/example/foo/Foo.java new file mode 100644 index 0000000000..b830275624 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/src/main/java/com/example/foo/Foo.java @@ -0,0 +1,31 @@ +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 interface Foo +{ + /** + * Frobnicates the foo. + */ + public void frobnicate(); +} diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/src/main/java/com/example/foo/impl/FooImpl.java b/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/src/main/java/com/example/foo/impl/FooImpl.java new file mode 100644 index 0000000000..2134a70c64 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/module1/src/main/java/com/example/foo/impl/FooImpl.java @@ -0,0 +1,35 @@ +package com.example.foo.impl; + +/* + * 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.example.foo.Foo; + +/** + * This is a FooImpl. + */ +public class FooImpl implements Foo +{ + /** + * Frobnicates the foo. + */ + public void frobnicate() + { + } +} \ No newline at end of file diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/module2/pom.xml b/maven-javadoc-plugin/src/it/MJAVADOC-497/module2/pom.xml new file mode 100644 index 0000000000..fc372c0e41 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/module2/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + + org.apache.maven.plugins.maven-javadoc-plugin.it + mjavadoc497 + 1.0-SNAPSHOT + + + org.apache.maven.plugins.maven-javadoc-plugin.it + mjavadoc497-module2 + 1.0-SNAPSHOT + Test MJAVADOC-497 Module 2 + + diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/module2/src/main/java/com/example/bar/Bar.java b/maven-javadoc-plugin/src/it/MJAVADOC-497/module2/src/main/java/com/example/bar/Bar.java new file mode 100644 index 0000000000..73d62937d9 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/module2/src/main/java/com/example/bar/Bar.java @@ -0,0 +1,33 @@ +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. + */ + +/** + * This is a Bar. + */ +public class Bar +{ + /** + * Glibbifies the bar. + */ + public void glibbify() + { + } +} diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/pom.xml b/maven-javadoc-plugin/src/it/MJAVADOC-497/pom.xml new file mode 100644 index 0000000000..9b89c69652 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.maven-javadoc-plugin.it + mjavadoc497 + pom + 1.0-SNAPSHOT + Test MJAVADOC-497 + + + module1 + module2 + + + + UTF-8 + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + @pom.version@ + + com.example.foo + *.impl.* + + + + + + + diff --git a/maven-javadoc-plugin/src/it/MJAVADOC-497/verify.bsh b/maven-javadoc-plugin/src/it/MJAVADOC-497/verify.bsh new file mode 100644 index 0000000000..1f30ebe801 --- /dev/null +++ b/maven-javadoc-plugin/src/it/MJAVADOC-497/verify.bsh @@ -0,0 +1,48 @@ + +/* + * 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.*; + +try +{ + File packageList = new File( basedir, "target/site/apidocs/package-list" ); + if ( !packageList.exists() ) + { + System.err.println( packageList + " is missing" ); + return false; + } + + FileReader fr = new FileReader( packageList ); + BufferedReader br = new BufferedReader( fr ); + String line = br.readLine(); + if ( !"com.example.foo".equals( line ) || br.readLine() != null ) + { + System.err.println( "package com.example.foo is not the only entry in the package-list" ); + return false; + } + br.close(); +} +catch ( Exception e ) +{ + e.printStackTrace(); + return false; +} + +return true; diff --git a/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java index 7ae025c01e..4eafc1c65b 100644 --- a/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -4594,8 +4594,6 @@ private void addJavadocOptions( List arguments, List sourcePaths } addArgIfNotEmpty( arguments, "-encoding", JavadocUtil.quotedArgument( getEncoding() ) ); - addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 ); - addArgIfNotEmpty( arguments, "-extdirs", JavadocUtil.quotedPathArgument( JavadocUtil.unifyPathSeparator( extdirs ) ) ); @@ -4620,6 +4618,9 @@ private void addJavadocOptions( List arguments, List sourcePaths } addArgIfNotEmpty( arguments, "-sourcepath", JavadocUtil.quotedPathArgument( getSourcePath( sourcePaths ) ) ); + // [MJAVADOC-497] must be after sourcepath is recalculated, since getExcludedPackages() depends on it + addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 ); + if ( StringUtils.isNotEmpty( sourcepath ) && isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) { addArgIfNotEmpty( arguments, "-subpackages", subpackages, SINCE_JAVADOC_1_5 );