Skip to content

Commit 0bb4c59

Browse files
jmleslawekjaranowski
authored andcommitted
Fix sources goal for multimodule projects
Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>
1 parent da5070f commit 0bb4c59

File tree

4 files changed

+105
-11
lines changed

4 files changed

+105
-11
lines changed
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project xmlns="http://maven.apache.org/POM/4.0.0"
22+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<parent>
27+
<groupId>org.apache.maven.its.dependency</groupId>
28+
<artifactId>tree-multimodule</artifactId>
29+
<version>1.0-SNAPSHOT</version>
30+
</parent>
31+
32+
<name>MultimoduleTest Module A</name>
33+
34+
<artifactId>tree-multimodule-module-a</artifactId>
35+
36+
<properties>
37+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
38+
</properties>
39+
40+
<dependencies>
41+
<dependency>
42+
<groupId>org.apache.maven</groupId>
43+
<artifactId>maven-project</artifactId>
44+
<version>2.0.6</version>
45+
</dependency>
46+
</dependencies>
47+
48+
</project>
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project xmlns="http://maven.apache.org/POM/4.0.0"
22+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<parent>
27+
<groupId>org.apache.maven.its.dependency</groupId>
28+
<artifactId>tree-multimodule</artifactId>
29+
<version>1.0-SNAPSHOT</version>
30+
</parent>
31+
32+
<name>MultimoduleTest Module B</name>
33+
34+
<artifactId>tree-multimodule-module-b</artifactId>
35+
36+
<properties>
37+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
38+
</properties>
39+
40+
<dependencies>
41+
<dependency>
42+
<groupId>org.apache.maven.its.dependency</groupId>
43+
<artifactId>tree-multimodule-module-a</artifactId>
44+
<version>${project.version}</version>
45+
</dependency>
46+
</dependencies>
47+
48+
</project>

src/it/projects/sources/pom.xml

+8-10
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,22 @@
2424
<modelVersion>4.0.0</modelVersion>
2525

2626
<groupId>org.apache.maven.its.dependency</groupId>
27-
<artifactId>test</artifactId>
27+
<artifactId>tree-multimodule</artifactId>
2828
<version>1.0-SNAPSHOT</version>
29+
<packaging>pom</packaging>
2930

30-
<name>Test</name>
31+
<name>MultimoduleTest</name>
3132
<description>
32-
Test dependency:sources
33+
Test dependency:tree on multimodule project
3334
</description>
3435

3536
<properties>
3637
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3738
</properties>
3839

39-
<dependencies>
40-
<dependency>
41-
<groupId>org.apache.maven</groupId>
42-
<artifactId>maven-project</artifactId>
43-
<version>2.0.8</version>
44-
</dependency>
45-
</dependencies>
40+
<modules>
41+
<module>module-a</module>
42+
<module>module-b</module>
43+
</modules>
4644

4745
</project>

src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
@Mojo(
3333
name = "sources",
3434
defaultPhase = LifecyclePhase.GENERATE_SOURCES,
35-
requiresDependencyResolution = ResolutionScope.TEST,
35+
requiresDependencyCollection = ResolutionScope.TEST,
3636
threadSafe = true)
3737
public class ResolveDependencySourcesMojo extends ResolveDependenciesMojo {
3838

0 commit comments

Comments
 (0)