Skip to content

Commit 87009a4

Browse files
Add integration test for install and deploy flattened pom
Fix #442
1 parent e02117c commit 87009a4

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean deploy
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<groupId>org.codehaus.mojo.flatten.its</groupId>
24+
<artifactId>flatten-deploy</artifactId>
25+
<version>0.0.1</version>
26+
27+
<properties>
28+
<!-- deploy to local repository -->
29+
<altDeploymentRepository>alt-id::file:target/repo</altDeploymentRepository>
30+
<dep.version>1.1</dep.version>
31+
</properties>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>org.codehaus.mojo.flatten.its</groupId>
36+
<artifactId>dep</artifactId>
37+
<version>${dep.version}</version>
38+
</dependency>
39+
</dependencies>
40+
41+
<build>
42+
<pluginManagement>
43+
<plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-install-plugin</artifactId>
47+
<version>@maven-install-plugin.version@</version>
48+
</plugin>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-deploy-plugin</artifactId>
52+
<version>@maven-deploy-plugin.version@</version>
53+
</plugin>
54+
</plugins>
55+
</pluginManagement>
56+
57+
<plugins>
58+
<plugin>
59+
<groupId>org.codehaus.mojo</groupId>
60+
<artifactId>flatten-maven-plugin</artifactId>
61+
<version>@project.version@</version>
62+
<executions>
63+
<!-- enable flattening -->
64+
<execution>
65+
<id>flatten</id>
66+
<phase>package</phase>
67+
<goals>
68+
<goal>flatten</goal>
69+
</goals>
70+
</execution>
71+
<!-- ensure proper cleanup -->
72+
<execution>
73+
<id>flatten.clean</id>
74+
<goals>
75+
<goal>clean</goal>
76+
</goals>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
</plugins>
81+
</build>
82+
</project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import groovy.xml.XmlSlurper
21+
22+
File flattenedPomFile = new File(basedir, '.flattened-pom.xml')
23+
assert flattenedPomFile.exists()
24+
25+
def flattenedPom = new XmlSlurper().parse(flattenedPomFile)
26+
// check that the pom is flattened
27+
assert 0 == flattenedPom.build.pluginManagement.size()
28+
assert 0 == flattenedPom.build.plugins.size()
29+
assert "1.1" == flattenedPom.dependencies.dependency[0].version.toString()
30+
31+
// check installed pom
32+
File flattenedInstallPomFile = new File(localRepositoryPath, 'org/codehaus/mojo/flatten/its/flatten-deploy/0.0.1/flatten-deploy-0.0.1.pom')
33+
assert flattenedInstallPomFile.exists()
34+
assert flattenedInstallPomFile.size() == flattenedPomFile.size()
35+
36+
def flattenedInstallPom = new XmlSlurper().parse(flattenedInstallPomFile)
37+
assert flattenedInstallPom == flattenedPom
38+
39+
// check deployed pom
40+
File flattenedDeployPomFile = new File(basedir, 'target/repo/org/codehaus/mojo/flatten/its/flatten-deploy/0.0.1/flatten-deploy-0.0.1.pom')
41+
assert flattenedDeployPomFile.exists()
42+
assert flattenedDeployPomFile.size() == flattenedPomFile.size()
43+
44+
def flattenedDeployPom = new XmlSlurper().parse(flattenedInstallPomFile)
45+
assert flattenedDeployPom == flattenedPom

0 commit comments

Comments
 (0)