Skip to content

Commit a5426e4

Browse files
committed
Fix tests with simplified build/consumer transformation
1 parent fd31464 commit a5426e4

24 files changed

+248
-138
lines changed

core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public void testPublishedPoms() throws Exception {
7979
new File(verifier.getArtifactPath(
8080
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6656-SNAPSHOT", "pom")));
8181

82+
assertTextEquals(
83+
new File(testDir, "expected/parent-build.pom"),
84+
new File(verifier.getArtifactPath(
85+
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6656-SNAPSHOT", "pom", "build")));
86+
8287
assertTextEquals(
8388
new File(testDir, "expected/simple-parent.pom"),
8489
new File(verifier.getArtifactPath(

core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6957BuildConsumer.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,21 @@ public void testPublishedPoms() throws Exception {
7777
new File(verifier.getArtifactPath(
7878
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom")));
7979

80+
assertTextEquals(
81+
new File(testDir, "expected/parent-build.pom"),
82+
new File(verifier.getArtifactPath(
83+
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
84+
8085
assertTextEquals(
8186
new File(testDir, "expected/simple-parent.pom"),
8287
new File(verifier.getArtifactPath(
8388
"org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6957-SNAPSHOT", "pom")));
8489

90+
assertTextEquals(
91+
new File(testDir, "expected/simple-parent-build.pom"),
92+
new File(verifier.getArtifactPath(
93+
"org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
94+
8595
assertTextEquals(
8696
new File(testDir, "expected/simple-weather.pom"),
8797
new File(verifier.getArtifactPath(
@@ -116,6 +126,11 @@ public void testPublishedPoms() throws Exception {
116126
new File(testDir, "expected/utils-parent.pom"),
117127
new File(verifier.getArtifactPath(
118128
"org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom")));
129+
130+
assertTextEquals(
131+
new File(testDir, "expected/utils-parent-build.pom"),
132+
new File(verifier.getArtifactPath(
133+
"org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
119134
}
120135

121136
static void assertTextEquals(File file1, File file2) throws IOException {

core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7836AlternativePomSyntaxTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ void testAlternativeSyntax() throws Exception {
6767
assertTrue(consumerPomLines.stream().anyMatch(l -> l.contains("<name>Apache-2.0</name>")));
6868
assertFalse(consumerPomLines.stream().anyMatch(l -> l.contains("<parent>")));
6969

70+
// The build pom is the original POM, so the hocon file
7071
assertTrue(Files.isRegularFile(buildPom));
7172
List<String> buildPomLines = Files.readAllLines(buildPom, StandardCharsets.UTF_8);
72-
assertFalse(buildPomLines.stream().anyMatch(l -> l.contains("<name>Apache-2.0</name>")));
73-
assertTrue(buildPomLines.stream().anyMatch(l -> l.contains("<parent>")));
73+
assertTrue(buildPomLines.stream().anyMatch(l -> l.contains("groupId = org.apache.maven.extensions")));
7474
}
7575
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" root="true" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/maven-v4_1_0.xsd">
21+
<groupId>org.sonatype.mavenbook.multi</groupId>
22+
<artifactId>parent</artifactId>
23+
<version>0.9-${changelist}-SNAPSHOT</version>
24+
<packaging>pom</packaging>
25+
<name>Multi Chapter Parent Project</name>
26+
27+
<!-- Optimized from https://github.com/sonatype/maven-example-en/tree/master/examples/ch-multi -->
28+
<modules>
29+
<module>simple-parent</module>
30+
</modules>
31+
</project>
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
11
<?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-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
2+
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
213
<modelVersion>4.0.0</modelVersion>
224
<groupId>org.sonatype.mavenbook.multi</groupId>
235
<artifactId>parent</artifactId>
246
<version>0.9-MNG6656-SNAPSHOT</version>
257
<packaging>pom</packaging>
268
<name>Multi Chapter Parent Project</name>
27-
28-
<!-- Optimized from https://github.com/sonatype/maven-example-en/tree/master/examples/ch-multi -->
29-
30-
</project>
9+
</project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
<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 https://maven.apache.org/maven-v4_0_0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.sonatype.mavenbook.multi</groupId>
24+
<artifactId>parent</artifactId>
25+
</parent>
26+
<artifactId>simple-parent</artifactId>
27+
<packaging>pom</packaging>
28+
<name>Multi Chapter Simple Parent Project</name>
29+
30+
<modules>
31+
<module>simple-weather</module>
32+
<module>simple-webapp</module>
33+
</modules>
34+
35+
<build>
36+
<pluginManagement>
37+
<plugins>
38+
<plugin>
39+
<groupId>org.apache.maven.plugins</groupId>
40+
<artifactId>maven-compiler-plugin</artifactId>
41+
</plugin>
42+
</plugins>
43+
</pluginManagement>
44+
</build>
45+
46+
</project>
Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
<?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-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
2+
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
213
<modelVersion>4.0.0</modelVersion>
224
<parent>
235
<groupId>org.sonatype.mavenbook.multi</groupId>
@@ -27,18 +9,13 @@ under the License.
279
<artifactId>simple-parent</artifactId>
2810
<packaging>pom</packaging>
2911
<name>Multi Chapter Simple Parent Project</name>
30-
31-
32-
3312
<build>
3413
<pluginManagement>
3514
<plugins>
3615
<plugin>
37-
<groupId>org.apache.maven.plugins</groupId>
3816
<artifactId>maven-compiler-plugin</artifactId>
3917
</plugin>
4018
</plugins>
4119
</pluginManagement>
4220
</build>
43-
44-
</project>
21+
</project>

core-it-suite/src/test/resources/mng-6656-buildconsumer/expected/simple-weather-build.pom

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ KIND, either express or implied. See the License for the
1717
specific language governing permissions and limitations
1818
under the License.
1919
-->
20-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
21-
<modelVersion>4.0.0</modelVersion>
20+
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/maven-v4_1_0.xsd">
2221
<parent>
2322
<groupId>org.sonatype.mavenbook.multi</groupId>
2423
<artifactId>simple-parent</artifactId>
25-
<version>0.9-MNG6656-SNAPSHOT</version>
2624
</parent>
2725
<artifactId>simple-weather</artifactId>
2826
<packaging>jar</packaging>

core-it-suite/src/test/resources/mng-6656-buildconsumer/expected/simple-webapp-build.pom

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ KIND, either express or implied. See the License for the
1717
specific language governing permissions and limitations
1818
under the License.
1919
-->
20-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
21-
<modelVersion>4.0.0</modelVersion>
20+
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/maven-v4_1_0.xsd">
2221
<parent>
2322
<groupId>org.sonatype.mavenbook.multi</groupId>
2423
<artifactId>simple-parent</artifactId>
25-
<version>0.9-MNG6656-SNAPSHOT</version>
2624
</parent>
2725

2826
<artifactId>simple-webapp</artifactId>
@@ -31,7 +29,6 @@ under the License.
3129
<dependency>
3230
<groupId>org.sonatype.mavenbook.multi</groupId>
3331
<artifactId>simple-weather</artifactId>
34-
<version>0.9-MNG6656-SNAPSHOT</version>
3532
</dependency>
3633
</dependencies>
3734
<build>

core-it-suite/src/test/resources/mng-6656-buildconsumer/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ KIND, either express or implied. See the License for the
1717
specific language governing permissions and limitations
1818
under the License.
1919
-->
20-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
21-
<modelVersion>4.0.0</modelVersion>
20+
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" root="true" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/maven-v4_1_0.xsd">
2221
<groupId>org.sonatype.mavenbook.multi</groupId>
2322
<artifactId>parent</artifactId>
2423
<version>0.9-${changelist}-SNAPSHOT</version>

core-it-suite/src/test/resources/mng-6656-buildconsumer/simple-parent/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ KIND, either express or implied. See the License for the
1717
specific language governing permissions and limitations
1818
under the License.
1919
-->
20-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
21-
<modelVersion>4.0.0</modelVersion>
20+
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/maven-v4_1_0.xsd">
2221
<parent>
2322
<groupId>org.sonatype.mavenbook.multi</groupId>
2423
<artifactId>parent</artifactId>

core-it-suite/src/test/resources/mng-6656-buildconsumer/simple-parent/simple-weather/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ KIND, either express or implied. See the License for the
1717
specific language governing permissions and limitations
1818
under the License.
1919
-->
20-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
21-
<modelVersion>4.0.0</modelVersion>
20+
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/maven-v4_1_0.xsd">
2221
<parent>
2322
<groupId>org.sonatype.mavenbook.multi</groupId>
2423
<artifactId>simple-parent</artifactId>

core-it-suite/src/test/resources/mng-6656-buildconsumer/simple-parent/simple-webapp/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ KIND, either express or implied. See the License for the
1717
specific language governing permissions and limitations
1818
under the License.
1919
-->
20-
<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 https://maven.apache.org/maven-v4_0_0.xsd">
21-
<modelVersion>4.0.0</modelVersion>
20+
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/maven-v4_1_0.xsd">
2221
<parent>
2322
<groupId>org.sonatype.mavenbook.multi</groupId>
2423
<artifactId>simple-parent</artifactId>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<groupId>org.sonatype.mavenbook.multi</groupId>
23+
<artifactId>parent</artifactId>
24+
<version>0.9-${changelist}-SNAPSHOT</version>
25+
<packaging>pom</packaging>
26+
<name>Multi Chapter Parent Project</name>
27+
28+
<!-- Optimized from https://github.com/sonatype/maven-example-en/tree/master/examples/ch-multi -->
29+
<modules>
30+
<module>simple-parent</module>
31+
</modules>
32+
</project>
Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
11
<?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-
-->
202
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
213
<modelVersion>4.0.0</modelVersion>
224
<groupId>org.sonatype.mavenbook.multi</groupId>
235
<artifactId>parent</artifactId>
246
<version>0.9-MNG6957-SNAPSHOT</version>
257
<packaging>pom</packaging>
268
<name>Multi Chapter Parent Project</name>
27-
28-
<!-- Optimized from https://github.com/sonatype/maven-example-en/tree/master/examples/ch-multi -->
29-
30-
</project>
9+
</project>

0 commit comments

Comments
 (0)