Skip to content

Commit

Permalink
Include Maven version requirement in the generated POM
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lutovich committed Aug 30, 2018
1 parent 366c1b9 commit 2b8bafd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gradle/java-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def cred = {
}
}

final MAVEN_PLUGIN_ARTIFACT_NAME = 'spotless-maven-plugin'

model {
publishing {
publications {
Expand Down Expand Up @@ -97,8 +99,12 @@ model {
distribution 'repo'
}
}
if (project.ext.artifactId == MAVEN_PLUGIN_ARTIFACT_NAME) {
// Maven plugin required Maven 3.1.0+ to run
prerequisites { maven '3.1.0' }
}
developers {
if (project.ext.artifactId == 'spotless-plugin-maven') {
if (project.ext.artifactId == MAVEN_PLUGIN_ARTIFACT_NAME) {
developer {
id 'lutovich'
name 'Konstantin Lutovich'
Expand Down
1 change: 1 addition & 0 deletions plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Skip `package-info.java` and `module-info.java` files from license header formatting. ([#273](https://github.com/diffplug/spotless/pull/273))
* Updated JSR305 annotation from 3.0.0 to 3.0.2 ([#274](https://github.com/diffplug/spotless/pull/274))
* Migrated from FindBugs annotations 3.0.0 to SpotBugs annotations 3.1.6 ([#274](https://github.com/diffplug/spotless/pull/274))
* Fix Maven version prerequisite in the generated POM ([#289](https://github.com/diffplug/spotless/pull/289))

### 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))

Expand Down
1 change: 1 addition & 0 deletions plugin-maven/src/test/resources/pom-build.xml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<name>Spotless Maven Plugin</name>

<!-- Require plugin to be built with Maven 3.1.0+ -->
<prerequisites>
<maven>3.1.0</maven>
</prerequisites>
Expand Down
5 changes: 5 additions & 0 deletions plugin-maven/src/test/resources/pom-test.xml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

<name>Spotless Maven Plugin Tests</name>

<!-- Require plugin to be tested with Maven 3.1.0+ -->
<prerequisites>
<maven>3.1.0</maven>
</prerequisites>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down

0 comments on commit 2b8bafd

Please sign in to comment.