This is an automated email from the ASF dual-hosted git repository. rfscholte pushed a commit to branch MJAVADOC-134 in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
commit 8037f0a498b75edf33589e058a6a98673284f4e5 Author: rfscholte <rfscho...@apache.org> AuthorDate: Mon Dec 17 22:26:45 2018 +0100 [MJAVADOC-134] Support aggregated reports at each level in the multi-module hierarchy --- .../MJAVADOC-134_multiaggregate/b/c/d1/pom.xml | 33 +++++++++ .../b/c/d1/src/main/java/a/b/c/d/D1.java | 25 +++++++ .../MJAVADOC-134_multiaggregate/b/c/d2/pom.xml | 33 +++++++++ .../b/c/d2/src/main/java/a/b/c/d/D2.java | 25 +++++++ .../MJAVADOC-134_multiaggregate/b/c/pom.xml | 39 ++++++++++ .../MJAVADOC-134_multiaggregate/b/e/pom.xml | 33 +++++++++ .../b/e/src/main/java/a/b/e/E.java | 25 +++++++ .../projects/MJAVADOC-134_multiaggregate/b/pom.xml | 39 ++++++++++ .../projects/MJAVADOC-134_multiaggregate/f/pom.xml | 33 +++++++++ .../f/src/main/java/a/f/F.java | 24 ++++++ .../MJAVADOC-134_multiaggregate/invoker.properties | 18 +++++ .../projects/MJAVADOC-134_multiaggregate/pom.xml | 86 ++++++++++++++++++++++ .../MJAVADOC-134_multiaggregate/verify.groovy | 60 +++++++++++++++ .../maven/plugins/javadoc/AbstractJavadocMojo.java | 74 ++++++++++++++++--- .../plugins/javadoc/AggregatorJavadocJar.java | 6 +- .../plugins/javadoc/AggregatorJavadocReport.java | 6 +- .../plugins/javadoc/AggregatorTestJavadocJar.java | 8 +- .../javadoc/AggregatorTestJavadocReport.java | 6 +- .../apache/maven/plugins/javadoc/JavadocJar.java | 2 +- .../maven/plugins/javadoc/JavadocReport.java | 2 +- src/site/apt/examples/aggregate.apt.vm | 46 +++++++++++- 21 files changed, 596 insertions(+), 27 deletions(-) diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d1/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d1/pom.xml new file mode 100644 index 0000000..423ac76 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d1/pom.xml @@ -0,0 +1,33 @@ +<?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> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc134c</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>mjavadoc134d1</artifactId> + +</project> diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d1/src/main/java/a/b/c/d/D1.java b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d1/src/main/java/a/b/c/d/D1.java new file mode 100644 index 0000000..3688552 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d1/src/main/java/a/b/c/d/D1.java @@ -0,0 +1,25 @@ +package a.b.c.d; + +/* + * 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 D1 +{ + +} \ No newline at end of file diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d2/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d2/pom.xml new file mode 100644 index 0000000..f1e343e --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d2/pom.xml @@ -0,0 +1,33 @@ +<?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> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc134c</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>mjavadoc13d2</artifactId> + +</project> diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d2/src/main/java/a/b/c/d/D2.java b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d2/src/main/java/a/b/c/d/D2.java new file mode 100644 index 0000000..d588de3 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/d2/src/main/java/a/b/c/d/D2.java @@ -0,0 +1,25 @@ +package a.b.c.d; + +/* + * 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 D2 +{ + +} \ No newline at end of file diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/c/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/pom.xml new file mode 100644 index 0000000..651c68d --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/c/pom.xml @@ -0,0 +1,39 @@ +<?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> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc134b</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>mjavadoc134c</artifactId> + <packaging>pom</packaging> + + <modules> + <module>d1</module> + <module>d2</module> + </modules> + +</project> diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/e/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/b/e/pom.xml new file mode 100644 index 0000000..6190c2e --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/e/pom.xml @@ -0,0 +1,33 @@ +<?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> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc134b</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>mjavadoc134e</artifactId> + +</project> diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/e/src/main/java/a/b/e/E.java b/src/it/projects/MJAVADOC-134_multiaggregate/b/e/src/main/java/a/b/e/E.java new file mode 100644 index 0000000..9b8dcb7 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/e/src/main/java/a/b/e/E.java @@ -0,0 +1,25 @@ +package a.b.e; + +/* + * 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 interface E +{ + +} \ No newline at end of file diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/b/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/b/pom.xml new file mode 100644 index 0000000..736b908 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/b/pom.xml @@ -0,0 +1,39 @@ +<?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> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc134</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>mjavadoc134b</artifactId> + <packaging>pom</packaging> + + <modules> + <module>c</module> + <module>e</module> + </modules> + +</project> diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/f/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/f/pom.xml new file mode 100644 index 0000000..df1e239 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/f/pom.xml @@ -0,0 +1,33 @@ +<?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> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc134</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>mjavadoc13df</artifactId> + +</project> diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/f/src/main/java/a/f/F.java b/src/it/projects/MJAVADOC-134_multiaggregate/f/src/main/java/a/f/F.java new file mode 100644 index 0000000..1f72633 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/f/src/main/java/a/f/F.java @@ -0,0 +1,24 @@ +package a.f; + +/* + * 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 interface F +{ +} \ No newline at end of file diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/invoker.properties b/src/it/projects/MJAVADOC-134_multiaggregate/invoker.properties new file mode 100644 index 0000000..a3d335e --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = site diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/pom.xml new file mode 100644 index 0000000..c11907e --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/pom.xml @@ -0,0 +1,86 @@ +<?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>mjavadoc134</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <url>https://issues.apache.org/jira/browse/MJAVADOC-134</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <modules> + <module>b</module> + <module>f</module> + </modules> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>@sitePluginVersion@</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>@project.version@</version> + </plugin> + </plugins> + </pluginManagement> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <reportSets> + <reportSet> + <reports> + <report>aggregate</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>2.9</version> + <reportSets> + <reportSet> + <reports> + <report>index</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> +</project> diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/verify.groovy b/src/it/projects/MJAVADOC-134_multiaggregate/verify.groovy new file mode 100644 index 0000000..c2709c3 --- /dev/null +++ b/src/it/projects/MJAVADOC-134_multiaggregate/verify.groovy @@ -0,0 +1,60 @@ +/* + * 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. + */ + +// A +assert new File( basedir, 'target/site/apidocs/a/b/c/d/D1.html').exists() +assert new File( basedir, 'target/site/apidocs/a/b/c/d/D2.html').exists() +assert new File( basedir, 'target/site/apidocs/a/b/e/E.html').exists() +assert new File( basedir, 'target/site/apidocs/a/f/F.html').exists() + +// B +assert new File( basedir, 'b/target/site/apidocs/a/b/c/d/D1.html').exists() +assert new File( basedir, 'b/target/site/apidocs/a/b/c/d/D2.html').exists() +assert new File( basedir, 'b/target/site/apidocs/a/b/e/E.html').exists() +assert !(new File( basedir, 'b/target/site/apidocs/a/f/F.html').exists()) + +// C +assert new File( basedir, 'b/c/target/site/apidocs/a/b/c/d/D1.html').exists() +assert new File( basedir, 'b/c/target/site/apidocs/a/b/c/d/D2.html').exists() +assert !(new File( basedir, 'b/c/target/site/apidocs/a/b/e/E.html').exists()) +assert !(new File( basedir, 'b/c/target/site/apidocs/a/f/F.html').exists()) + +// D1 +assert new File( basedir, 'b/c/d1/target/site/apidocs/a/b/c/d/D1.html').exists() +assert !(new File( basedir, 'b/c/d1/target/site/apidocs/a/b/c/d/D2.html').exists()) +assert !(new File( basedir, 'b/c/d1/target/site/apidocs/a/b/e/E.html').exists()) +assert !(new File( basedir, 'b/c/d1/target/site/apidocs/a/f/F.html').exists()) + +// D2 +assert !(new File( basedir, 'b/c/d2/target/site/apidocs/a/b/c/d/D1.html').exists()) +assert new File( basedir, 'b/c/d2/target/site/apidocs/a/b/c/d/D2.html').exists() +assert !(new File( basedir, 'b/c/d2/target/site/apidocs/a/b/e/E.html').exists()) +assert !(new File( basedir, 'b/c/d2/target/site/apidocs/a/f/F.html').exists()) + +// E +assert !(new File( basedir, 'b/e/target/site/apidocs/a/b/c/d/D1.html').exists()) +assert !(new File( basedir, 'b/e/target/site/apidocs/a/b/c/d/D2.html').exists()) +assert new File( basedir, 'b/e/target/site/apidocs/a/b/e/E.html').exists() +assert !(new File( basedir, 'b/e/target/site/apidocs/a/f/F.html').exists()) + +// F +assert !(new File( basedir, 'f/target/site/apidocs/a/b/c/d/D1.html').exists()) +assert !(new File( basedir, 'f/target/site/apidocs/a/b/c/d/D2.html').exists()) +assert !(new File( basedir, 'f/target/site/apidocs/a/b/e/E.html').exists()) +assert new File( basedir, 'f/target/site/apidocs/a/f/F.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 b1e9f56..88b83bc 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -118,6 +118,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -1970,11 +1971,6 @@ public abstract class AbstractJavadocMojo return; } - if ( isAggregator() && !project.isExecutionRoot() ) - { - return; - } - if ( getLog().isDebugEnabled() ) { this.debug = true; @@ -2277,9 +2273,9 @@ public abstract class AbstractJavadocMojo mappedSourcePaths.putAll( getDependencySourcePaths() ); } - if ( isAggregator() && project.isExecutionRoot() ) + if ( isAggregator() ) { - for ( MavenProject subProject : reactorProjects ) + for ( MavenProject subProject : getAggregatedProjects() ) { if ( subProject != project ) { @@ -2335,6 +2331,57 @@ public abstract class AbstractJavadocMojo return mappedSourcePaths; } + private Collection<MavenProject> getAggregatedProjects() + { + Map<Path, MavenProject> reactorProjectsMap = new HashMap<>(); + for ( MavenProject reactorProject : this.reactorProjects ) + { + reactorProjectsMap.put( reactorProject.getBasedir().toPath(), reactorProject ); + } + + return modulesForAggregatedProject( project, reactorProjectsMap ); + } + + /** + * Recursively add the modules of the aggregatedProject to the set of aggregatedModules. + * + * @param aggregatedProject the project being aggregated + * @param reactorProjectsMap map of (still) available reactor projects + * @throws MavenReportException if any + */ + private Set<MavenProject> modulesForAggregatedProject( MavenProject aggregatedProject, + Map<Path, MavenProject> reactorProjectsMap ) + { + // Maven does not supply an easy way to get the projects representing + // the modules of a project. So we will get the paths to the base + // directories of the modules from the project and compare with the + // base directories of the projects in the reactor. + + if ( aggregatedProject.getModules().isEmpty() ) + { + return Collections.singleton( aggregatedProject ); + } + + List<Path> modulePaths = new LinkedList<Path>(); + for ( String module : aggregatedProject.getModules() ) + { + modulePaths.add( new File( aggregatedProject.getBasedir(), module ).toPath() ); + } + + Set<MavenProject> aggregatedModules = new LinkedHashSet<>(); + + for ( Path modulePath : modulePaths ) + { + MavenProject module = reactorProjectsMap.remove( modulePath ); + if ( module != null ) + { + aggregatedModules.addAll( modulesForAggregatedProject( module, reactorProjectsMap ) ); + } + } + + return aggregatedModules; + } + /** * Override this method to customize the configuration for resolving dependency sources. The default * behavior enables the resolution of -sources jar files. @@ -2604,10 +2651,13 @@ public abstract class AbstractJavadocMojo populateCompileArtifactMap( compileArtifactMap, project.getArtifacts() ); - if ( isAggregator() && project.isExecutionRoot() ) + + if ( isAggregator() ) { + Collection<MavenProject> aggregatorProjects = getAggregatedProjects(); + List<String> reactorArtifacts = new ArrayList<>(); - for ( MavenProject p : reactorProjects ) + for ( MavenProject p : aggregatorProjects ) { reactorArtifacts.add( p.getGroupId() + ':' + p.getArtifactId() ); } @@ -2616,7 +2666,7 @@ public abstract class AbstractJavadocMojo new PatternExclusionsFilter( reactorArtifacts ), getDependencyScopeFilter() ) ); - for ( MavenProject subProject : reactorProjects ) + for ( MavenProject subProject : aggregatorProjects ) { if ( subProject != project ) { @@ -4187,9 +4237,9 @@ public abstract class AbstractJavadocMojo JavadocUtil.copyJavadocResources( anOutputDirectory, getJavadocDirectory(), excludedocfilessubdir ); } - if ( isAggregator() && project.isExecutionRoot() ) + if ( isAggregator() ) { - for ( MavenProject subProject : reactorProjects ) + for ( MavenProject subProject : getAggregatedProjects() ) { if ( subProject != project && getJavadocDirectory() != null ) { diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java index 3478bce..45ee30a 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java @@ -25,9 +25,11 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; /** - * Bundles the Javadoc documentation for main <code>Java code</code> in an <b>aggregator</b> project into a jar - * using the standard <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>. + * <p>Bundles the Javadoc documentation for main <code>Java code</code> in an <b>aggregator</b> project into a jar + * using the standard <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>.</p> * + * <p>Since version 3.1.0 an aggregated jar is created for every module of a Maven multimodule project.</p> + * * @version $Id: AggregatorJavadocJar.java 1749408 2016-06-20 22:54:15Z schulte $ * @since 2.6 */ diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java index 27e0641..cbe2459 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java @@ -25,8 +25,10 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; /** - * Generates documentation for the <code>Java code</code> in an <b>aggregator</b> project using the standard - * <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>. + * <p>Generates documentation for the <code>Java code</code> in an <b>aggregator</b> project using the standard + * <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>.</p> + * + * <p>Since version 3.1.0 an aggregated report is created for every module of a Maven multimodule project.</p> * * @author <a href="mailto:vincent.sive...@gmail.com">Vincent Siveton</a> * @version $Id: AggregatorJavadocReport.java 1749408 2016-06-20 22:54:15Z schulte $ diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java index 7f8158f..4b1a3b2 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java @@ -25,9 +25,11 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; /** - * Bundles the Javadoc documentation for <code>Java Test code</code> in an <b>aggregator</b> project into a jar - * using the standard <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>. - * + * <p>Bundles the Javadoc documentation for <code>Java Test code</code> in an <b>aggregator</b> project into a jar + * using the standard <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>.</p> + * + * <p>Since version 3.1.0 an aggregated jar is created for every module of a Maven multimodule project.</p> + * * @version $Id: AggregatorTestJavadocJar.java 1749408 2016-06-20 22:54:15Z schulte $ * @since 2.6 */ diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java index 8968ce3..ee65a8b 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java @@ -25,9 +25,11 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; /** - * Generates documentation for the <code>Java Test code</code> in an <b>aggregator</b> project using the standard - * <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>. + * <p>Generates documentation for the <code>Java Test code</code> in an <b>aggregator</b> project using the standard + * <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>.</p> * + * <p>Since version 3.1.0 an aggregated report is created for every module of a Maven multimodule project.</p> + * * @author <a href="mailto:vincent.sive...@gmail.com">Vincent Siveton</a> * @version $Id: AggregatorTestJavadocReport.java 1749408 2016-06-20 22:54:15Z schulte $ * @since 2.5 diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java index c343a58..1c57a68 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java @@ -175,7 +175,7 @@ public class JavadocJar innerDestDir = new File( getOutputDirectory() ); } - if ( !( "pom".equalsIgnoreCase( project.getPackaging() ) && isAggregator() ) ) + if ( isAggregator() || !"pom".equalsIgnoreCase( project.getPackaging() ) ) { ArtifactHandler artifactHandler = project.getArtifact().getArtifactHandler(); if ( !"java".equals( artifactHandler.getLanguage() ) ) diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java index 4fba34f..bbc034f 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java @@ -226,7 +226,7 @@ public class JavadocReport { boolean canGenerate = false; - if ( !this.isAggregator() || this.project.isExecutionRoot() ) + if ( this.isAggregator() || !"pom".equals( this.project.getPackaging() ) ) { Collection<String> sourcePaths; List<String> files; diff --git a/src/site/apt/examples/aggregate.apt.vm b/src/site/apt/examples/aggregate.apt.vm index 53d541b..c10e094 100644 --- a/src/site/apt/examples/aggregate.apt.vm +++ b/src/site/apt/examples/aggregate.apt.vm @@ -37,9 +37,13 @@ Project |-- pom.xml |-- Module1 | `-- pom.xml - |-- Module2 + | `-- Module 2 + | `-- pom.xml + | `-- Module 3 + | `-- pom.xml + |-- Module4 | `-- pom.xml - `-- Module3 + `-- Module5 `-- pom.xml +-----+ @@ -50,8 +54,42 @@ Project <<<aggregate>>> goal instead of. The {{{../javadoc-mojo.html#aggregate}\<aggregate/\>}} parameter can be used to generate javadocs for multi-module - projects. It gives the option to - generate one javadoc report for the entire project (all modules) or generate one javadoc report for each module. + projects. It gives the option to generate one javadoc report for the entire project (all modules) or generate one + javadoc report for each module. Since 3.1.0 the <<<aggregate>>> has changed a little bit. It'll generate aggregated + reports at every level. + To get only an aggregated project at root level, you need to configure the pom like: + + +-----+ +<project> + ... + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>${project.version}</version> + <reportSets> + <reportSet> + <id>aggregate</id> + <inherited>false</inherited> + <reports> + <report>aggregate</report> + </reports> + </reportSet> + <reportSet> + <id>default</id> + <reports> + <report>javadoc</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + ... + </reporting> + ... +</project> ++-----+ When you execute javadoc:javadoc from Project directory with aggregate set to <<true>>, a javadoc report will be created in the target directory of Project with all the javadocs of Project's modules included. If aggregate is