From users-return-144173-archive-asf-public=cust-asf.ponee.io@maven.apache.org Thu Aug 1 19:45:27 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A30A8180644 for ; Thu, 1 Aug 2019 21:45:27 +0200 (CEST) Received: (qmail 28501 invoked by uid 500); 1 Aug 2019 19:45:25 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 89789 invoked by uid 99); 1 Aug 2019 09:23:55 -0000 X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.003 X-Spam-Level: *** X-Spam-Status: No, score=3.003 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received-SPF: None (mailfrom) identity=mailfrom; client-ip=178.32.120.239; helo=5.mo7.mail-out.ovh.net; envelope-from=matthieu@brouillard.fr; receiver= X-Gm-Message-State: APjAAAVnHOhPHyjSm06paWwp2DwvSxSHEdVf34xtYRVXsMSsygsNv5FM V4vXv3cTpuLMsaRZHsjNQPc7bwMrZsQoG8EMIqo= X-Google-Smtp-Source: APXvYqwXHYR2abDESOvfgzhvScg4BngHLwODqenCFoO3nOkayqyJkaBB2PZRq3rwkQ/SJCW+QHuIieV9njIv+eHBQG0= X-Received: by 2002:a1c:b706:: with SMTP id h6mr111908679wmf.119.1564651424483; Thu, 01 Aug 2019 02:23:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Matthieu BROUILLARD Date: Thu, 1 Aug 2019 11:23:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Using Git tags to cut releases to Maven Central from TravisCI To: Maven Users List Content-Type: multipart/alternative; boundary="0000000000005a9069058f0accab" X-Ovh-Tracer-Id: 12655396432034928399 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -51 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrleejgddugecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenogfuuhhsphgvtghtffhomhgrihhnucdlgeelmd --0000000000005a9069058f0accab Content-Type: text/plain; charset="UTF-8" Hi Ben, several years ago I created jgitver to cover such a use case and even more. It uses git information (tags, branches, commits, metadatas, ...) to automatically compute a version based on configurable rules. So like you I can simply do: `git tag X.Y.Z && mvn deploy` jgitver brings more features & configuration capabilities without never modifying the pom files (like `mvn versions -dnewVersion` does). It is a solution among others but it is worthwhile trying it. An issue with solutions like yours is reproducibility : `git checkout X.Y.Z && mvn install`will not build again artifact-X.Y.Z ; but this can be considered minor depending on the use cases & needs. FYI here are the projects I maintain related to the topic: - jgitver library: https://github.com/jgitver/jgitver - jgitver maven extension: https://github.com/jgitver/jgitver-maven-plugin - jgitver gradle plugin: https://github.com/jgitver/gradle-jgitver-plugin Regards, Matthieu On Wed, Jul 31, 2019 at 5:51 PM Ben Podgursky wrote: > I've been experimenting with setting up Maven Central publishing from a > TravisCI build (since it's free for my OSS GitHub project), and I ended up > with a pattern that I think is pretty nice to work with (I've struggled > with the maven-deploy-plugin in the past). > > I've written it up here > > https://bpodgursky.com/2019/07/31/using-travisci-to-deploy-to-maven-central-via-git-tagging-aka-death-to-commit-clutter/ > but > tl,dr, the key thing I haven't seen used widely is the use of tags to > define release versions, eg: > > ``` > if [ ! -z "$TRAVIS_TAG" ] > then > mvn --settings "${TRAVIS_BUILD_DIR}/.travis/mvn-settings.xml" > org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=$TRAVIS_TAG > 1>/dev/null 2>/dev/null > else > echo "No tags, using snapshot version from pom.xml" > fi > > mvn deploy -P publish -DskipTests=true --settings > "${TRAVIS_BUILD_DIR}/.travis/mvn-settings.xml" > ``` > > This lets me cut a central release by just pushing a tag: > > ``` > $ git tag 1.23 > $ git push origin 1.23 > ``` > > I've used Maven a fair amount but I wouldn't consider myself perfectly in > tune with best practices, so I'm curious what others think of this > approach, or if there are other streamlined central deploy setups > (especially from CI/Travis) that I missed. > > > Thanks, > > Ben > --0000000000005a9069058f0accab--