Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cyan-sloths-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"changesets": minor
---

This change introduces a version policy (`ChangesetsVersionPolicy`) compatible with the Release Maven plugin, together with a flag `useReleasePluginIntegration` (default `false`) on the `prepare` goal. Enabling this flag will disable updating POM versions in `prepare` and only perform changeset processing. Updating versions in POMs can then be delegated to the Release plugin, together with all the other facilities that plugin provides.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,39 @@ to enable easier management of changelogs and semantically versioned releases.
Our goal is to keep compatibility with the files and formats of the original implementation as far as it makes sense, so that
users recognize the ways of working and feel at home.

This is it, at the moment. Stay tuned for more docs later on, thanks!
This is it, at the moment. Stay tuned for more docs later on, thanks!

# Release Maven Plugin Integration

To delegate versioning to the Release Maven Plugin, you can use the `ChangesetsVersionPolicy` together with the `useReleasePluginIntegration` flag:

```
<build>
<plugins>
<plugin>
<groupId>se.fortnox.changesets</groupId>
<artifactId>changesets-maven-plugin</artifactId>
<version>${changesets.plugin.version}</version>
<configuration>
<useReleasePluginIntegration>true</useReleasePluginIntegration> <!-- Disables version updates in prepare goal -->
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<projectVersionPolicyId>changesets</projectVersionPolicyId>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
<dependencies>
<dependency>
<groupId>se.fortnox.changesets</groupId>
<artifactId>changesets-maven-plugin</artifactId>
<version>${changesets.plugin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
```

Goals should then be invoked as `changesets:prepare release:prepare release:perform`. `changesets:release` should *not* be used.
194 changes: 97 additions & 97 deletions changesets-java/pom.xml
Original file line number Diff line number Diff line change
@@ -1,108 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>se.fortnox.changesets</groupId>
<artifactId>changesets</artifactId>
<version>0.1.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>se.fortnox.changesets</groupId>
<artifactId>changesets</artifactId>
<version>0.1.1-SNAPSHOT</version>
</parent>

<artifactId>changesets-java</artifactId>
<description>Java library for handling of changesets</description>
<artifactId>changesets-java</artifactId>
<description>Java library for handling of changesets</description>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.semver4j</groupId>
<artifactId>semver4j</artifactId>
</dependency>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.semver4j</groupId>
<artifactId>semver4j</artifactId>
</dependency>

<dependency>
<groupId>org.codehaus.mojo.versions</groupId>
<artifactId>versions-common</artifactId>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-all</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.mojo.versions</groupId>
<artifactId>versions-common</artifactId>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-all</artifactId>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.hosuaby</groupId>
<artifactId>inject-resources-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.hosuaby</groupId>
<artifactId>inject-resources-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>io.hosuaby</groupId>
<artifactId>inject-resources-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.hosuaby</groupId>
<artifactId>inject-resources-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ public static String getNewVersion(String version, List<Changeset> changes) {
}
return semanticVersion.getVersion();
}

public static String nextDevelopmentVersion(String actualVersion) {
return Optional.ofNullable(Semver.coerce(actualVersion))
.map(semver -> semver.withIncPatch().withPreRelease("SNAPSHOT").getVersion())
.orElseThrow(() -> new IllegalArgumentException("Cannot coerce \"%s\" into a semantic version.".formatted(actualVersion)));
}
}
Loading
Loading