You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2020/04/08 10:24:14 UTC

[maven-javadoc-plugin] branch master updated: [MJAVADOC-617] Normalize module path so that '..' in the path are resolved (#27)

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new d39b275  [MJAVADOC-617] Normalize module path so that '..' in the path are resolved (#27)
d39b275 is described below

commit d39b2755b3c94318e38fb69cd156f9d3f701a15d
Author: Reto Weiss <re...@ivyteam.ch>
AuthorDate: Wed Apr 8 12:24:04 2020 +0200

    [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
---
 .../maven/plugins/javadoc/AbstractJavadocMojo.java |  3 +-
 .../javadoc/AggregatorJavadocReportTest.java       | 34 ++++++++----
 ...=> AbstractAggregateChildMavenProjectStub.java} | 15 +++--
 ...java => AbstractAggregateMavenProjectStub.java} | 18 +++---
 ...NotInSubFolderProject1TestMavenProjectStub.java | 34 ++++++++++++
 ...NotInSubFolderProject2TestMavenProjectStub.java | 34 ++++++++++++
 ...ggregateNotInSubFolderTestMavenProjectStub.java | 36 ++++++++++++
 ...egateResourcesProject1TestMavenProjectStub.java | 55 ++-----------------
 ...egateResourcesProject2TestMavenProjectStub.java | 55 ++-----------------
 .../AggregateResourcesTestMavenProjectStub.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, 345 insertions(+), 181 deletions(-)

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 d376dc2..21f4b0a 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 @@ public abstract class AbstractJavadocMojo
             return Collections.singleton( aggregatedProject );
         }
 
+        Path basePath = aggregatedProject.getBasedir().toPath();
         List<Path> modulePaths = new LinkedList<>();
         for ( String module :  aggregatedProject.getModules() )
         {
-            modulePaths.add( new File( aggregatedProject.getBasedir(), module ).toPath() );
+            modulePaths.add( basePath.resolve( module ).normalize() );
         }
 
         Set<MavenProject> 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 1bfad67..f8a4e25 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.File;
 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 class AggregatorJavadocReportTest
         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( "<a href=\"resources/test/package-summary.html\">resources.test</a>" ) );
         assertTrue( overview.contains( ">blabla</" ) );
         assertTrue( overview.contains( "<a href=\"resources/test2/package-summary.html\">resources.test2</a>" ) );
@@ -257,4 +250,25 @@ public class AggregatorJavadocReportTest
         assertTrue( overview.contains( "<img src=\"doc-files/maven-feather.png\" alt=\"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/AggregateResourcesProject1TestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateChildMavenProjectStub.java
similarity index 81%
copy from src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java
copy to src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateChildMavenProjectStub.java
index 71657c1..d384294 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesProject1TestMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateChildMavenProjectStub.java
@@ -30,14 +30,17 @@ import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
 
 /**
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @author <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
  */
-public class AggregateResourcesProject1TestMavenProjectStub
+public class AbstractAggregateChildMavenProjectStub
     extends MavenProjectStub
 {
-    public AggregateResourcesProject1TestMavenProjectStub()
+    private String baseDir;
+
+    public AbstractAggregateChildMavenProjectStub(String baseDir, String pomFileName, String targetDirectory)
     {
-        readModel( new File( getBasedir(), "pom.xml" ) );
+        this.baseDir = baseDir;
+        readModel( new File( getBasedir(), pomFileName ) );
 
         setGroupId( Objects.toString( getModel().getGroupId(), getModel().getParent().getGroupId() ) );
         setArtifactId( getModel().getArtifactId() );
@@ -55,7 +58,7 @@ public class AggregateResourcesProject1TestMavenProjectStub
         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" );
+        build.setDirectory( super.getBasedir() + targetDirectory );
         setBuild( build );
 
         List<String> compileSourceRoots = new ArrayList<>();
@@ -67,7 +70,7 @@ public class AggregateResourcesProject1TestMavenProjectStub
     @Override
     public File getBasedir()
     {
-        return new File( super.getBasedir() + "/src/test/resources/unit/aggregate-resources-test/project1" );
+        return new File( super.getBasedir() + baseDir );
     }
 
     /** {@inheritDoc} */
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesTestMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateMavenProjectStub.java
similarity index 76%
copy from src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesTestMavenProjectStub.java
copy to src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateMavenProjectStub.java
index 4d1c5e5..759daab 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/stubs/AggregateResourcesTestMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/AbstractAggregateMavenProjectStub.java
@@ -32,14 +32,18 @@ import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
 
 /**
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @author <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
  */
-public class AggregateResourcesTestMavenProjectStub
+public class AbstractAggregateMavenProjectStub
     extends MavenProjectStub
 {
-    public AggregateResourcesTestMavenProjectStub()
+    private final String baseDir;
+    private final String[] projects;
+    public AbstractAggregateMavenProjectStub(String baseDir, String pomFileName, String targetDirectory, String... projects)
     {
-        readModel( new File( getBasedir(), "aggregate-resources-test-plugin-config.xml" ) );
+        this.baseDir = baseDir;
+        this.projects = projects;
+        readModel( new File( getBasedir(), pomFileName) );
 
         setGroupId( getModel().getGroupId() );
         setArtifactId( getModel().getArtifactId() );
@@ -53,7 +57,7 @@ public class AggregateResourcesTestMavenProjectStub
         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" );
+        build.setDirectory( super.getBasedir() + targetDirectory );
         setBuild( build );
 
         List<String> compileSourceRoots = new ArrayList<>();
@@ -63,7 +67,7 @@ public class AggregateResourcesTestMavenProjectStub
     @Override
     public File getBasedir()
     {
-        return new File( super.getBasedir() + "/src/test/resources/unit/aggregate-resources-test" );
+        return new File( super.getBasedir() + baseDir);
     }
 
     @Override
@@ -75,7 +79,7 @@ public class AggregateResourcesTestMavenProjectStub
     @Override
     public List<String> getModules()
     {
-        return Arrays.asList( "project1", "project2" );
+        return Arrays.asList( projects );
     }
 
     @Override
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 0000000..2c3be01
--- /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 <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
+ */
+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 0000000..4a47343
--- /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 <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
+ */
+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 0000000..1ac9d9b
--- /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 <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
+ */
+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 71657c1..d1e9de7 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 @@ package org.apache.maven.plugins.javadoc.stubs;
  * 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 <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @author <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
  */
 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<String> 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 58a164c..ee45b9f 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 @@ package org.apache.maven.plugins.javadoc.stubs;
  * 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 <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @author <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
  */
 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<String> 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 4d1c5e5..db7547a 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 @@ package org.apache.maven.plugins.javadoc.stubs;
  * 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 <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @author <a href="mailto:reto.weiss@axonivy.com">Reto Weiss</a>
  */
 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<String> 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<String> getModules()
-    {
-        return Arrays.asList( "project1", "project2" );
-    }
-
-    @Override
-    public Set<Artifact> 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 0000000..6cbef91
--- /dev/null
+++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/all/pom.xml
@@ -0,0 +1,63 @@
+<!--
+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.unit</groupId>
+  <artifactId>aggregate-modules-not-in-subfolders-test-resources-test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  
+  <modules>
+    <module>../project1</module>
+    <module>../project2</module>
+  </modules>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <encoding>ISO-8859-1</encoding>
+          <project implementation="org.apache.maven.plugins.javadoc.stubs.AggregateNotInSubFolderTestMavenProjectStub"/>
+          <localRepository>${localRepository}</localRepository>
+          <outputDirectory>${basedir}/target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs</outputDirectory>
+          <javadocOptionsDir>${basedir}/target/test/unit/aggregate-modules-not-in-subfolders-test/target/javadoc-bundle-options</javadocOptionsDir>
+          <windowtitle>Maven Javadoc Plugin aggregate resources 1.0-SNAPSHOT API</windowtitle>
+                    <reactorProjects>
+            <project implementation="org.apache.maven.plugins.javadoc.stubs.AggregateNotInSubFolderTestMavenProjectStub"/>
+            <project implementation="org.apache.maven.plugins.javadoc.stubs.AggregateNotInSubFolderProject1TestMavenProjectStub"/>
+            <project implementation="org.apache.maven.plugins.javadoc.stubs.AggregateNotInSubFolderProject2TestMavenProjectStub"/>
+          </reactorProjects>
+          
+          <show>protected</show>
+          <groups/>
+          <tags/>
+          <quiet>true</quiet>
+          <javadocDirectory>${basedir}/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/src/main/javadoc</javadocDirectory>
+          <debug>true</debug>
+          <docfilessubdirs>true</docfilessubdirs>
+          <stylesheet>java</stylesheet>
+          <failOnError>true</failOnError>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
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 0000000..0350abc
--- /dev/null
+++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project1/pom.xml
@@ -0,0 +1,31 @@
+<!--
+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.unit</groupId>
+    <artifactId>aggregate-modules-not-in-subfolders-test-resources-test</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+	<groupId>org.apache.maven.plugins.maven-javadoc-plugin.unit</groupId>
+	<artifactId>aggregate-modules-not-in-subfolders-test-resources-test-project1</artifactId>
+	<version>1.0-SNAPSHOT</version>
+	<packaging>jar</packaging>
+</project>
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 0000000..646e04d
--- /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 0000000..7b847b5
--- /dev/null
+++ b/src/test/resources/unit/aggregate-modules-not-in-subfolders-test/project2/pom.xml
@@ -0,0 +1,32 @@
+<!--
+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.unit</groupId>
+    <artifactId>aggregate-modules-not-in-subfolders-test-resources-test</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.maven.plugins.maven-javadoc-plugin.unit</groupId>
+  <artifactId>aggregate-modules-not-in-subfolders-test-resources-test-project2</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+</project>
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 0000000..a001109
--- /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
+{}