Skip to content

Commit 47d0f8e

Browse files
committed
Use flatten-maven plugin to make sure that no test dependencies are in the published poms
1 parent e0ec93d commit 47d0f8e

4 files changed

Lines changed: 63 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ test-output
2525
.DS_Store
2626

2727
dependency-reduced-pom.xml
28+
.flattened-pom.xml

parent/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@
8686
<dependencyManagement>
8787
<dependencies>
8888

89+
<dependency>
90+
<groupId>${groupId}</groupId>
91+
<artifactId>gem-api</artifactId>
92+
<version>${project.version}</version>
93+
</dependency>
94+
<dependency>
95+
<groupId>${groupId}</groupId>
96+
<artifactId>gem-processor</artifactId>
97+
<version>${project.version}</version>
98+
</dependency>
99+
89100
<dependency>
90101
<groupId>org.freemarker</groupId>
91102
<artifactId>freemarker</artifactId>
@@ -262,6 +273,11 @@
262273
<artifactId>jacoco-maven-plugin</artifactId>
263274
<version>0.8.3</version>
264275
</plugin>
276+
<plugin>
277+
<groupId>org.codehaus.mojo</groupId>
278+
<artifactId>flatten-maven-plugin</artifactId>
279+
<version>1.2.1</version>
280+
</plugin>
265281
</plugins>
266282
</pluginManagement>
267283

@@ -287,6 +303,7 @@
287303
<exclude>*.yml</exclude>
288304
<exclude>mvnw*</exclude>
289305
<exclude>**/*.asciidoc</exclude>
306+
<exclude>**/*.flattened-pom.xml</exclude>
290307
</excludes>
291308
<mapping>
292309
<java>SLASHSTAR_STYLE</java>
@@ -314,6 +331,34 @@
314331
</execution>
315332
</executions>
316333
</plugin>
334+
<plugin>
335+
<groupId>org.codehaus.mojo</groupId>
336+
<artifactId>flatten-maven-plugin</artifactId>
337+
<executions>
338+
<execution>
339+
<!-- Tidy up all POMs before they are published -->
340+
<id>flatten</id>
341+
<phase>package</phase>
342+
<goals>
343+
<goal>flatten</goal>
344+
</goals>
345+
<configuration>
346+
<updatePomFile>true</updatePomFile>
347+
<flattenMode>ossrh</flattenMode>
348+
<pomElements>
349+
<parent>expand</parent>
350+
</pomElements>
351+
</configuration>
352+
</execution>
353+
<execution>
354+
<id>flatten-clean</id>
355+
<phase>clean</phase>
356+
<goals>
357+
<goal>clean</goal>
358+
</goals>
359+
</execution>
360+
</executions>
361+
</plugin>
317362
</plugins>
318363
</build>
319364

processor/pom.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<dependency>
3131
<groupId>${project.parent.groupId}</groupId>
3232
<artifactId>gem-api</artifactId>
33-
<version>${project.parent.version}</version>
3433
<scope>provided</scope>
3534
</dependency>
3635

@@ -140,6 +139,23 @@
140139
</execution>
141140
</executions>
142141
</plugin>
142+
<plugin>
143+
<groupId>org.codehaus.mojo</groupId>
144+
<artifactId>flatten-maven-plugin</artifactId>
145+
<executions>
146+
<execution>
147+
<!-- Tidy up all POMs before they are published -->
148+
<id>flatten</id>
149+
<phase>package</phase>
150+
<goals>
151+
<goal>flatten</goal>
152+
</goals>
153+
<configuration>
154+
<updatePomFile>true</updatePomFile>
155+
</configuration>
156+
</execution>
157+
</executions>
158+
</plugin>
143159
<plugin>
144160
<groupId>org.apache.maven.plugins</groupId>
145161
<artifactId>maven-dependency-plugin</artifactId>

test/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<dependency>
2424
<groupId>${project.parent.groupId}</groupId>
2525
<artifactId>gem-api</artifactId>
26-
<version>${project.parent.version}</version>
2726
</dependency>
2827

2928
</dependencies>

0 commit comments

Comments
 (0)