diff --git a/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java b/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java
index ac8f02a..5ce905b 100644
--- a/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java
@@ -19,6 +19,8 @@
package org.apache.maven.plugins.source;
import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
/**
* @author Maria Odea Ching
@@ -122,4 +124,17 @@ public void testIncludeMavenDescriptorWhenExplicitlyConfigured() throws Exceptio
}),
"sources");
}
+
+ public void testIncludesAdditionalSourcesFromMain() throws Exception {
+ // must include MRJar configuration from the compiler plugin
+ doTestProjectWithSourceArchive(
+ "msources-144",
+ addMavenDescriptor("msources-144", new String[] {
+ "SomeClass.java",
+ "META-INF/versions/9/SomeClass.java"
+ }
+ ),
+ "sources"
+ );
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/MSources144Stub.java b/src/test/java/org/apache/maven/plugins/source/stubs/MSources144Stub.java
new file mode 100644
index 0000000..8cb33e5
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/MSources144Stub.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugins.source.stubs;
+
+import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MSources144Stub extends MavenProjectStub {
+ private Build build;
+
+ private List resources;
+
+ private List testResources;
+
+ public MSources144Stub() {
+ Model model;
+
+ try {
+ model = readModelFromFile(new File(getBasedir(), "target/test-classes/unit/msources-144/pom.xml"));
+ setModel(model);
+
+ setFile(new File(getBasedir(), "target/test-classes/unit/msources-144/pom.xml"));
+
+ setGroupId(model.getGroupId());
+ setArtifactId(model.getArtifactId());
+ setVersion(model.getVersion());
+ setName(model.getName());
+ setUrl(model.getUrl());
+ setPackaging(model.getPackaging());
+
+ Build build = new Build();
+ build.setFinalName(getArtifactId() + "-" + getVersion());
+ build.setDirectory(getBasedir() + "/target/test/unit/msources-144/target");
+
+ setBuild(build);
+
+ String basedir = getBasedir().getAbsolutePath();
+ List compileSourceRoots = new ArrayList<>();
+ compileSourceRoots.add(basedir + "/target/test-classes/unit/msources-144/src/main/java");
+ setCompileSourceRoots(compileSourceRoots);
+
+ List testCompileSourceRoots = new ArrayList<>();
+ testCompileSourceRoots.add(basedir + "/target/test-classes/unit/msources-144/src/test/java");
+ setTestCompileSourceRoots(testCompileSourceRoots);
+
+ setResources(model.getBuild().getResources());
+ setTestResources(model.getBuild().getTestResources());
+
+ SourcePluginArtifactStub artifact =
+ new SourcePluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging(), null);
+ artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
+ artifact.setType("jar");
+ artifact.setBaseVersion("1.0-SNAPSHOT");
+ setArtifact(artifact);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public Build getBuild() {
+ return build;
+ }
+
+ public void setBuild(Build build) {
+ this.build = build;
+ }
+
+ public List getResources() {
+ return resources;
+ }
+
+ public void setResources(List resources) {
+ this.resources = resources;
+ }
+
+ public List getTestResources() {
+ return testResources;
+ }
+
+ public void setTestResources(List testResources) {
+ this.testResources = testResources;
+ }
+}
diff --git a/src/test/resources/unit/msources-144/pom.xml b/src/test/resources/unit/msources-144/pom.xml
new file mode 100644
index 0000000..ecb41e8
--- /dev/null
+++ b/src/test/resources/unit/msources-144/pom.xml
@@ -0,0 +1,63 @@
+
+
+
+ 4.0.0
+
+ source
+ maven-source-plugin-test-msources-144
+ 99.0
+ jar
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ ${basedir}/target/test/unit/msources-144/target
+ maven-source-plugin-test-msources-144-99.0
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ compile-java9
+ compile
+
+ compile
+
+
+
+ ${project.basedir}/src/main/java9
+
+ ${project.build.outputDirectory}/META-INF/versions/9
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/unit/msources-144/src/main/java/SomeClass.java b/src/test/resources/unit/msources-144/src/main/java/SomeClass.java
new file mode 100644
index 0000000..a56faae
--- /dev/null
+++ b/src/test/resources/unit/msources-144/src/main/java/SomeClass.java
@@ -0,0 +1,21 @@
+/*
+ * 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 SomeClass() {
+
+}
diff --git a/src/test/resources/unit/msources-144/src/main/java9/SomeClass.java b/src/test/resources/unit/msources-144/src/main/java9/SomeClass.java
new file mode 100644
index 0000000..a6c2b32
--- /dev/null
+++ b/src/test/resources/unit/msources-144/src/main/java9/SomeClass.java
@@ -0,0 +1,21 @@
+/*
+ * 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 SomeClass {
+
+}