Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What version label to use for a forked maven project?

I often times have to fork a Java project that uses Maven (usually on github).

When I fork the project and make my changes I generally want to cut a release to my own private (but on the internet) maven repository.

Thus the question of what the version label should be for my custom release. I can't do SNAPSHOT as I need it to be a release. Sometimes I suffix the project with .ADAMGENT (cause I'm a narcissist). Lets say I fork 1.0.4-SNAPSHOT. I might change it to 1.0.4.ADAMGENT . I have no idea if that is a good idea. In some cases I can't even suffix it with .ADAMGENT as Spring's Gradle build tools don't like that. So for Spring projects I do .ADAMGENT.RELEASE or .ADAMGENT.M1 if its a milestone.

What do others do?

Update: although I said fork I ment more of a patch level change. The bounty (by a different user) on the other hand might be for fork and/or patch

like image 877
Adam Gent Avatar asked May 02 '12 14:05

Adam Gent


People also ask

What is fork in Maven?

It supports the same syntax as -T in maven-core: if you terminate the value with a 'C', that value will be multiplied with the number of available CPU cores in your system. For example forkCount=2.5C on a Quad-Core system will result in forking up to ten concurrent JVM processes that execute tests.

What is classifier in Maven POM?

classifier: The classifier distinguishes artifacts that were built from the same POM but differ in content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number.

What are Maven coordinates?

Maven coordinates define a set of identifiers which can be used to uniquely identify a project, a dependency, or a plugin in a Maven POM.

What is a POM dependency?

POM is an acronym for Project Object Model. The pom. xml file contains information of project and configuration information for the maven to build the project such as dependencies, build directory, source directory, test source directory, plugin, goals etc. Maven reads the pom. xml file, then executes the goal.


1 Answers

Because you are forking, use a different group ID.

The reality is, that once you start making changes to your local fork, it is a different artifact. An artifact that is made by your organization, not the one you took it from.

With regard to version number, if your changes are always going to be minor, I'd use the major and possibly the minor version number of the source tree when I forked, otherwise, I'd start all over again at 1.0.0 and make a note in the project POM regarding what version I forked it from.

For example:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.adamgent</groupId>
    <artifactId>project-xyz</artifactId> <!-- same artifact ID -->
    <version>1.0.0-RELEASE</version>
    <name>My Project XYZ</name> <!-- different display name -->
    <description>My fork of project XYZ created from v5.42.0 of original sources.</description>
    ....

It isn't any more difficult to switch a group ID for a dependency than to switch a version ID. Both mechanisms can be used to easily get you the release artifact you want. However, by changing the group ID, you get the follow advantages:

  1. you can more easily keep track of your forks within Nexus
  2. you eliminate any confusion that might arise from having artifacts from an organization that they did not create
  3. you stay within the standard guidelines for Maven version identifiers
like image 53
HDave Avatar answered Nov 16 '22 14:11

HDave