Skip to content

Example project to demonstrate the functionality of the java-semver-checker

Notifications You must be signed in to change notification settings

h16r/jsc-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This project showcases the integration and configuration of the java-semver-checker maven plugin. To try it out for yourself simply clone the repository and run the following commands:

#if not already done, install plugin
git clone https://github.com/trpouh/java-semver-checker.git
cd java-semver-checker
mvn install
cd..

# install the project
git clone https://github.com/trpouh/jsc-example.git
cd jsc-example

# non breaking
mvn verify

# breaking
git checkout feature
mvn verify

# breaking - CLI
mvn semver-checker:check -Dbaseline.ref=main -Dcurrent.ref=feature 

The codebase has two branches:

  • main
  • feature

The project is structured like a standard maven project and contains one public class. The feature branch contains a commit that removes the public class (breaking change!)

The java-semver-checker maven plugin is configured to check the current git ref (commit, branch, tag) against the main ref.

<configuration>
    <baselineRef>main</baselineRef>
</configuration>

it is also configured to be executed in the verify phase of the maven project.

<executions>
    <execution>
        <id>check-semver</id>
        <goals>
            <goal>check</goal>
        </goals>
        <phase>validate</phase>
    </execution>
</executions>

Which results in a breaking build when trying to verify the project:

mvn verify
[...]
[ERROR] ------------------------------------------------------------------------
[ERROR] 
[ERROR] Found 1 Rule violation
[ERROR] 
[ERROR] Rule ClassMissingCheck (class has been renamed or removed): 1 violations
[ERROR] For more info see: https://github.com/trpouh/java-semver-checker#major-renamingmovingremoving-any-public-elements
[ERROR] 
[ERROR] Locations: 
[ERROR] - at.hks.semverchecker.example.Main
[ERROR] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.739 s
[INFO] Finished at: 2023-12-17T23:22:30+01:00
[INFO] ------------------------------------------------------------------------

About

Example project to demonstrate the functionality of the java-semver-checker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages