Skip to content

Retarget-deploy generates extremely long names for snapshot artifacts #117

@PayBas

Description

@PayBas

The following code of the retarget-deploy mojo can cause problems on some filesystems. By injecting the entire name into the otherDeployBranchPattern artifacts, it can create very very long directories and file-names.

https://github.com/egineering-llc/gitflow-helper-maven-plugin/blob/master/src/main/java/com/e_gineering/maven/gitflowhelper/RetargetDeployMojo.java#L89-L91

    /**
     * Given a String version (which may be a final or -SNAPSHOT version) return a
     * version version string mangled to include a `+normalized-branch-name-SNAPSHOT format version.
     *
     * @param version The base version (ie, 1.0.2-SNAPSHOT)
     * @param branchName to be normalized
     * @return A mangled version string with the branchname and -SNAPSHOT.
     */
    private String getAsBranchSnapshotVersion(final String version, final String branchName) {
        return version.replace("-SNAPSHOT", "") + otherBranchVersionDelimiter + branchName.replaceAll("[^0-9A-Za-z-.]", "-") + "-SNAPSHOT";
    }

For my current project we already inject a unique revision number into the version numbers (based on git describe --tags) to handle this issue. Having the gitflow-helper-maven-plugin come along and alter them to inject yet (much) more characters is undesirable.

I would suggest that this getAsBranchSnapshotVersion() call should be enabled by default for otherDeployBranchPattern branches (but the branch-name truncated to say 40chars), but an additional option to disable this call altogether for users (like me) who use a different solution.
Perhaps "snapshotArtifactUniqueNaming" with default = true?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions