Skip to content

Commit 2b8bafd

Browse files
committed
Include Maven version requirement in the generated POM
Before this commit, it was only included in the POM used to build the plugin. It is different from the POM that's being published to Maven Central. Later is generated using `generatePomFileForPluginMavenPublication` gradle task. This resulted in Maven version requirement not being enforced and builds failing with confusing error messages. Also added `prerequisites` section to the POM used to test the plugin.
1 parent 366c1b9 commit 2b8bafd

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

gradle/java-publish.gradle

+7-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def cred = {
6464
}
6565
}
6666

67+
final MAVEN_PLUGIN_ARTIFACT_NAME = 'spotless-maven-plugin'
68+
6769
model {
6870
publishing {
6971
publications {
@@ -97,8 +99,12 @@ model {
9799
distribution 'repo'
98100
}
99101
}
102+
if (project.ext.artifactId == MAVEN_PLUGIN_ARTIFACT_NAME) {
103+
// Maven plugin required Maven 3.1.0+ to run
104+
prerequisites { maven '3.1.0' }
105+
}
100106
developers {
101-
if (project.ext.artifactId == 'spotless-plugin-maven') {
107+
if (project.ext.artifactId == MAVEN_PLUGIN_ARTIFACT_NAME) {
102108
developer {
103109
id 'lutovich'
104110
name 'Konstantin Lutovich'

plugin-maven/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Skip `package-info.java` and `module-info.java` files from license header formatting. ([#273](https://github.com/diffplug/spotless/pull/273))
66
* Updated JSR305 annotation from 3.0.0 to 3.0.2 ([#274](https://github.com/diffplug/spotless/pull/274))
77
* Migrated from FindBugs annotations 3.0.0 to SpotBugs annotations 3.1.6 ([#274](https://github.com/diffplug/spotless/pull/274))
8+
* Fix Maven version prerequisite in the generated POM ([#289](https://github.com/diffplug/spotless/pull/289))
89

910
### Version 1.14.0 - July 24th 2018 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-maven-plugin/1.14.0/), [jcenter](https://bintray.com/diffplug/opensource/spotless-maven-plugin/1.14.0))
1011

plugin-maven/src/test/resources/pom-build.xml.mustache

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
<name>Spotless Maven Plugin</name>
1111

12+
<!-- Require plugin to be built with Maven 3.1.0+ -->
1213
<prerequisites>
1314
<maven>3.1.0</maven>
1415
</prerequisites>

plugin-maven/src/test/resources/pom-test.xml.mustache

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
<name>Spotless Maven Plugin Tests</name>
1010

11+
<!-- Require plugin to be tested with Maven 3.1.0+ -->
12+
<prerequisites>
13+
<maven>3.1.0</maven>
14+
</prerequisites>
15+
1116
<properties>
1217
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1318
<maven.compiler.source>1.8</maven.compiler.source>

0 commit comments

Comments
 (0)