From d39b2755b3c94318e38fb69cd156f9d3f701a15d Mon Sep 17 00:00:00 2001 From: Reto Weiss Date: Wed, 8 Apr 2020 12:24:04 +0200 Subject: [PATCH] [MJAVADOC-617] Normalize module path so that '..' in the path are resolved (#27) * MJAVADOC-617 Normalize module path so that '..' in the path are resolved On line 2403 a path is removed from a map. The given path may not be normalized but the pathes in the map are. This leads to the fact that the project for the given path is not found. And therefore no javadoc for the project is generated. By normalizing the module path on line 2396 the code works event if the module path has '..' in it. * MJAVADOC-617 Add regression test * MJAVADOC-617 Simplify code as suggested by review * MJAVADOC-617 Fix checkstyle problems * MJAVADOC-617 Refactor duplicated code into abstract sub classes - Refactor duplicated code into common new AbstractAggregateMavenProjectStub and AbstractAggregateChildMavenProjectStub classes - Fix toLowerCase without Locale - Simplify method getOverviewSummary and make it static * MJAVADOC-617 improve test assertions --- .../plugins/javadoc/AbstractJavadocMojo.java | 3 +- .../javadoc/AggregatorJavadocReportTest.java | 34 ++++--- ...bstractAggregateChildMavenProjectStub.java | 82 +++++++++++++++++ .../AbstractAggregateMavenProjectStub.java | 90 +++++++++++++++++++ ...SubFolderProject1TestMavenProjectStub.java | 34 +++++++ ...SubFolderProject2TestMavenProjectStub.java | 34 +++++++ ...ateNotInSubFolderTestMavenProjectStub.java | 36 ++++++++ ...ResourcesProject1TestMavenProjectStub.java | 55 ++---------- ...ResourcesProject2TestMavenProjectStub.java | 55 ++---------- ...ggregateResourcesTestMavenProjectStub.java | 64 ++----------- .../all/pom.xml | 63 +++++++++++++ .../project1/pom.xml | 31 +++++++ .../project1/src/main/java/test1/Hello.java | 26 ++++++ .../project2/pom.xml | 32 +++++++ .../project2/src/main/java/test2/World.java | 26 ++++++ 15 files changed, 497 insertions(+), 168 deletions(-) create mode 100644 src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateChildMavenProjectStub.java create mode 100644 src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateMavenProjectStub.java create mode 100644 src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject1TestMavenProjectStub.java create mode 100644 src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject2TestMavenProjectStub.java create mode 100644 src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderTestMavenProjectStub.java create mode 100644 src/test/resources/unit/aggregate-modules-not-in-subfolders-test/all/pom.xml create mode 100644 src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/pom.xml create mode 100644 src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/src/main/java/test1/Hello.java create mode 100644 src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/pom.xml create mode 100644 src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/src/main/java/test2/World.java 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 d376dc2b..21f4b0a7 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -2401,10 +2401,11 @@ private Set modulesForAggregatedProject( MavenProject aggregatedPr return Collections.singleton( aggregatedProject ); } + Path basePath = aggregatedProject.getBasedir().toPath(); List modulePaths = new LinkedList<>(); for ( String module : aggregatedProject.getModules() ) { - modulePaths.add( new File( aggregatedProject.getBasedir(), module ).toPath() ); + modulePaths.add( basePath.resolve( module ).normalize() ); } Set aggregatedModules = new LinkedHashSet<>(); diff --git a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java index 1bfad67b..f8a4e255 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java @@ -24,6 +24,7 @@ import java.io.FileReader; import java.io.IOException; import java.util.List; +import java.util.Locale; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; @@ -232,18 +233,10 @@ public void testAggregateJavadocResources() File apidocs = new File( getBasedir(), "target/test/unit/aggregate-resources-test/target/site/apidocs" ); // Test overview - File overviewSummary; - if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) ) - { - overviewSummary = new File( apidocs, "overview-summary.html" ); - } - else - { - overviewSummary = new File( apidocs, "index.html" ); - } + File overviewSummary = getOverviewSummary(apidocs); assertTrue( overviewSummary.exists() ); - String overview = readFile( overviewSummary ).toLowerCase(); + String overview = readFile( overviewSummary ).toLowerCase( Locale.ENGLISH ); assertTrue( overview.contains( "resources.test" ) ); assertTrue( overview.contains( ">blablaresources.test2" ) ); @@ -257,4 +250,25 @@ public void testAggregateJavadocResources() assertTrue( overview.contains( "\"Maven\"" ) ); assertTrue( new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() ); } + + public void testAggregateWithModulsNotInSubFolders() throws Exception + { + File testPom = new File( unit, "aggregate-modules-not-in-subfolders-test/all/pom.xml"); + JavadocReport mojo = lookupMojo( testPom ); + mojo.execute(); + + File apidocs = new File( getBasedir(), "target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs" ); + assertTrue( apidocs.isDirectory() ); + assertTrue( getOverviewSummary( apidocs ).isFile() ); + } + + private static File getOverviewSummary(File apidocs) + { + if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) ) + { + return new File( apidocs, "overview-summary.html" ); + } + return new File( apidocs, "index.html" ); + } + } diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateChildMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateChildMavenProjectStub.java new file mode 100644 index 00000000..d384294f --- /dev/null +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateChildMavenProjectStub.java @@ -0,0 +1,82 @@ +package org.apache.maven.plugins.javadoc.stubs; + +/* + * 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.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.Build; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.project.MavenProject; + +/** + * @author Reto Weiss + */ +public class AbstractAggregateChildMavenProjectStub + extends MavenProjectStub +{ + private String baseDir; + + public AbstractAggregateChildMavenProjectStub(String baseDir, String pomFileName, String targetDirectory) + { + this.baseDir = baseDir; + readModel( new File( getBasedir(), pomFileName ) ); + + setGroupId( Objects.toString( getModel().getGroupId(), getModel().getParent().getGroupId() ) ); + setArtifactId( getModel().getArtifactId() ); + setVersion( Objects.toString( getModel().getVersion(), getModel().getParent().getVersion() ) ); + setName( getModel().getName() ); + setUrl( getModel().getUrl() ); + setPackaging( getModel().getPackaging() ); + + setExecutionRoot( true ); + + Artifact artifact = new JavadocPluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging() ); + artifact.setArtifactHandler( new DefaultArtifactHandlerStub() ); + setArtifact( artifact ); + + Build build = new Build(); + build.setFinalName( getModel().getArtifactId() ); + build.setSourceDirectory( getBasedir() + "/src/main/java" ); + build.setDirectory( super.getBasedir() + targetDirectory ); + setBuild( build ); + + List compileSourceRoots = new ArrayList<>(); + compileSourceRoots.add( getBasedir().getAbsolutePath() + "/src/main/java" ); + setCompileSourceRoots( compileSourceRoots ); + } + + /** {@inheritDoc} */ + @Override + public File getBasedir() + { + return new File( super.getBasedir() + baseDir ); + } + + /** {@inheritDoc} */ + @Override + public MavenProject getExecutionProject() + { + return this; + } +} diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateMavenProjectStub.java new file mode 100644 index 00000000..759daaba --- /dev/null +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateMavenProjectStub.java @@ -0,0 +1,90 @@ +package org.apache.maven.plugins.javadoc.stubs; + +/* + * 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.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.Build; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.project.MavenProject; + +/** + * @author Reto Weiss + */ +public class AbstractAggregateMavenProjectStub + extends MavenProjectStub +{ + private final String baseDir; + private final String[] projects; + public AbstractAggregateMavenProjectStub(String baseDir, String pomFileName, String targetDirectory, String... projects) + { + this.baseDir = baseDir; + this.projects = projects; + readModel( new File( getBasedir(), pomFileName) ); + + setGroupId( getModel().getGroupId() ); + setArtifactId( getModel().getArtifactId() ); + setVersion( getModel().getVersion() ); + setName( getModel().getName() ); + setUrl( getModel().getUrl() ); + setPackaging( getModel().getPackaging() ); + + setExecutionRoot( true ); + + Build build = new Build(); + build.setFinalName( getModel().getArtifactId() ); + build.setSourceDirectory( getBasedir() + "/src/main/java" ); + build.setDirectory( super.getBasedir() + targetDirectory ); + setBuild( build ); + + List compileSourceRoots = new ArrayList<>(); + setCompileSourceRoots( compileSourceRoots ); + } + + @Override + public File getBasedir() + { + return new File( super.getBasedir() + baseDir); + } + + @Override + public MavenProject getExecutionProject() + { + return this; + } + + @Override + public List getModules() + { + return Arrays.asList( projects ); + } + + @Override + public Set getDependencyArtifacts() + { + return Collections.emptySet(); + } +} diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject1TestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject1TestMavenProjectStub.java new file mode 100644 index 00000000..2c3be01b --- /dev/null +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject1TestMavenProjectStub.java @@ -0,0 +1,34 @@ +package org.apache.maven.plugins.javadoc.stubs; + +/* + * 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. + */ + +/** + * @author Reto Weiss + */ +public class AggregateNotInSubFolderProject1TestMavenProjectStub + extends AbstractAggregateChildMavenProjectStub +{ + public AggregateNotInSubFolderProject1TestMavenProjectStub() + { + super( "/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1", + "pom.xml", + "/target/test/unit/aggregate-modules-not-in-subfolders-test/project1/target" ); + } +} diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject2TestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject2TestMavenProjectStub.java new file mode 100644 index 00000000..4a47343c --- /dev/null +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderProject2TestMavenProjectStub.java @@ -0,0 +1,34 @@ +package org.apache.maven.plugins.javadoc.stubs; + +/* + * 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. + */ + +/** + * @author Reto Weiss + */ +public class AggregateNotInSubFolderProject2TestMavenProjectStub + extends AbstractAggregateChildMavenProjectStub +{ + public AggregateNotInSubFolderProject2TestMavenProjectStub() + { + super( "/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2", + "pom.xml", + "/target/test/unit/aggregate-modules-not-in-subfolders-test/project2/target"); + } +} diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderTestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderTestMavenProjectStub.java new file mode 100644 index 00000000..1ac9d9be --- /dev/null +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateNotInSubFolderTestMavenProjectStub.java @@ -0,0 +1,36 @@ +package org.apache.maven.plugins.javadoc.stubs; + +/* + * 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. + */ + +/** + * @author Reto Weiss + */ +public class AggregateNotInSubFolderTestMavenProjectStub + extends AbstractAggregateMavenProjectStub +{ + public AggregateNotInSubFolderTestMavenProjectStub() + { + super( "/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/all", + "pom.xml", + "/target/test/unit/aggregate-modules-not-in-subfolders-test/target", + "../project1", + "../project2"); + } +} diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java index 71657c10..d1e9de72 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java @@ -19,61 +19,16 @@ * under the License. */ -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Build; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; -import org.apache.maven.project.MavenProject; - /** - * @author Vincent Siveton + * @author Reto Weiss */ public class AggregateResourcesProject1TestMavenProjectStub - extends MavenProjectStub + extends AbstractAggregateChildMavenProjectStub { public AggregateResourcesProject1TestMavenProjectStub() { - readModel( new File( getBasedir(), "pom.xml" ) ); - - setGroupId( Objects.toString( getModel().getGroupId(), getModel().getParent().getGroupId() ) ); - setArtifactId( getModel().getArtifactId() ); - setVersion( Objects.toString( getModel().getVersion(), getModel().getParent().getVersion() ) ); - setName( getModel().getName() ); - setUrl( getModel().getUrl() ); - setPackaging( getModel().getPackaging() ); - - setExecutionRoot( true ); - - Artifact artifact = new JavadocPluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging() ); - artifact.setArtifactHandler( new DefaultArtifactHandlerStub() ); - setArtifact( artifact ); - - Build build = new Build(); - build.setFinalName( getModel().getArtifactId() ); - build.setSourceDirectory( getBasedir() + "/src/main/java" ); - build.setDirectory( super.getBasedir() + "/target/test/unit/aggregate-resources-test/project1/target" ); - setBuild( build ); - - List compileSourceRoots = new ArrayList<>(); - compileSourceRoots.add( getBasedir().getAbsolutePath() + "/src/main/java" ); - setCompileSourceRoots( compileSourceRoots ); - } - - /** {@inheritDoc} */ - @Override - public File getBasedir() - { - return new File( super.getBasedir() + "/src/test/resources/unit/aggregate-resources-test/project1" ); - } - - /** {@inheritDoc} */ - @Override - public MavenProject getExecutionProject() - { - return this; + super( "/src/test/resources/unit/aggregate-resources-test/project1", + "pom.xml", + "/target/test/unit/aggregate-resources-test/project1/target" ); } } diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java index 58a164ce..ee45b9f7 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject2TestMavenProjectStub.java @@ -19,61 +19,16 @@ * under the License. */ -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Build; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; -import org.apache.maven.project.MavenProject; - /** - * @author Vincent Siveton + * @author Reto Weiss */ public class AggregateResourcesProject2TestMavenProjectStub - extends MavenProjectStub + extends AbstractAggregateChildMavenProjectStub { public AggregateResourcesProject2TestMavenProjectStub() { - readModel( new File( getBasedir(), "pom.xml" ) ); - - setGroupId( Objects.toString( getModel().getGroupId(), getModel().getParent().getGroupId() ) ); - setArtifactId( getModel().getArtifactId() ); - setVersion( Objects.toString( getModel().getVersion(), getModel().getParent().getVersion() ) ); - setName( getModel().getName() ); - setUrl( getModel().getUrl() ); - setPackaging( getModel().getPackaging() ); - - setExecutionRoot( true ); - - Artifact artifact = new JavadocPluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging() ); - artifact.setArtifactHandler( new DefaultArtifactHandlerStub() ); - setArtifact( artifact ); - - Build build = new Build(); - build.setFinalName( getModel().getArtifactId() ); - build.setSourceDirectory( getBasedir() + "/src/main/java" ); - build.setDirectory( super.getBasedir() + "/target/test/unit/aggregate-resources-test/project2/target" ); - setBuild( build ); - - List compileSourceRoots = new ArrayList<>(); - compileSourceRoots.add( getBasedir() + "/src/main/java" ); - setCompileSourceRoots( compileSourceRoots ); - } - - /** {@inheritDoc} */ - @Override - public File getBasedir() - { - return new File( super.getBasedir() + "/src/test/resources/unit/aggregate-resources-test/project2" ); - } - - /** {@inheritDoc} */ - @Override - public MavenProject getExecutionProject() - { - return this; + super( "/src/test/resources/unit/aggregate-resources-test/project2", + "pom.xml", + "/target/test/unit/aggregate-resources-test/project2/target" ); } } diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesTestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesTestMavenProjectStub.java index 4d1c5e52..db7547a5 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesTestMavenProjectStub.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesTestMavenProjectStub.java @@ -19,68 +19,18 @@ * under the License. */ -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Build; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; -import org.apache.maven.project.MavenProject; - /** - * @author Vincent Siveton + * @author Reto Weiss */ public class AggregateResourcesTestMavenProjectStub - extends MavenProjectStub + extends AbstractAggregateMavenProjectStub { public AggregateResourcesTestMavenProjectStub() { - readModel( new File( getBasedir(), "aggregate-resources-test-plugin-config.xml" ) ); - - setGroupId( getModel().getGroupId() ); - setArtifactId( getModel().getArtifactId() ); - setVersion( getModel().getVersion() ); - setName( getModel().getName() ); - setUrl( getModel().getUrl() ); - setPackaging( getModel().getPackaging() ); - - setExecutionRoot( true ); - - Build build = new Build(); - build.setFinalName( getModel().getArtifactId() ); - build.setSourceDirectory( getBasedir() + "/src/main/java" ); - build.setDirectory( super.getBasedir() + "/target/test/unit/aggregate-resources-test/target" ); - setBuild( build ); - - List compileSourceRoots = new ArrayList<>(); - setCompileSourceRoots( compileSourceRoots ); - } - - @Override - public File getBasedir() - { - return new File( super.getBasedir() + "/src/test/resources/unit/aggregate-resources-test" ); - } - - @Override - public MavenProject getExecutionProject() - { - return this; - } - - @Override - public List getModules() - { - return Arrays.asList( "project1", "project2" ); - } - - @Override - public Set getDependencyArtifacts() - { - return Collections.emptySet(); + super( "/src/test/resources/unit/aggregate-resources-test", + "aggregate-resources-test-plugin-config.xml", + "/target/test/unit/aggregate-resources-test/target", + "project1", + "project2" ); } } diff --git a/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/all/pom.xml b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/all/pom.xml new file mode 100644 index 00000000..6cbef91b --- /dev/null +++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/all/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + org.apache.maven.plugins.maven-javadoc-plugin.unit + aggregate-modules-not-in-subfolders-test-resources-test + 1.0-SNAPSHOT + pom + + + ../project1 + ../project2 + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + ISO-8859-1 + + ${localRepository} + ${basedir}/target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs + ${basedir}/target/test/unit/aggregate-modules-not-in-subfolders-test/target/javadoc-bundle-options + Maven Javadoc Plugin aggregate resources 1.0-SNAPSHOT API + + + + + + + protected + + + true + ${basedir}/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/src/main/javadoc + true + true + java + true + + + + + diff --git a/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/pom.xml b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/pom.xml new file mode 100644 index 00000000..0350abc8 --- /dev/null +++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + org.apache.maven.plugins.maven-javadoc-plugin.unit + aggregate-modules-not-in-subfolders-test-resources-test + 1.0-SNAPSHOT + + org.apache.maven.plugins.maven-javadoc-plugin.unit + aggregate-modules-not-in-subfolders-test-resources-test-project1 + 1.0-SNAPSHOT + jar + diff --git a/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/src/main/java/test1/Hello.java b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/src/main/java/test1/Hello.java new file mode 100644 index 00000000..646e04da --- /dev/null +++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/src/main/java/test1/Hello.java @@ -0,0 +1,26 @@ +package test1; + +/* + * 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 Hello + */ +public class Hello +{} diff --git a/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/pom.xml b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/pom.xml new file mode 100644 index 00000000..7b847b5a --- /dev/null +++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + + org.apache.maven.plugins.maven-javadoc-plugin.unit + aggregate-modules-not-in-subfolders-test-resources-test + 1.0-SNAPSHOT + + org.apache.maven.plugins.maven-javadoc-plugin.unit + aggregate-modules-not-in-subfolders-test-resources-test-project2 + 1.0-SNAPSHOT + jar + diff --git a/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/src/main/java/test2/World.java b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/src/main/java/test2/World.java new file mode 100644 index 00000000..a001109d --- /dev/null +++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/src/main/java/test2/World.java @@ -0,0 +1,26 @@ +package test2; + +/* + * 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 World + */ +public class World +{}