I believe I came up with a simple solution: My POM now looks like

    <groupId>my.group.id</groupId>
    <version>${revision}</version>
    <artifactId>my-artifact-id</artifactId>
    <properties>
        <build.number></build.number>
        <revision>1.2${build.number}</revision>
    </properties>

So, ${build.number} is empty by default, unless in Jenkins, where I
define it as ".${env.BUILD_NUMBER}".

Jochen

On Thu, Nov 22, 2018 at 12:19 PM Anders Hammar <and...@hammar.net> wrote:
>
> Why not just update the pom (but not commit to scm) with a step like
> mvn versions:set -DnewVersion=$newVersion
> ?
>
> And newVersion you would parse from the pom file and add ${build.number} to
> it.
>
> /Anders
>
> On Thu, Nov 22, 2018 at 12:14 PM Jochen Wiedmann <jochen.wiedm...@gmail.com>
> wrote:
>
> > Hi,
> >
> > when running Maven outside of Jenkins, I have the version number (for
> > example) 1.2, which is just fine. However, within Jenkins I'd like
> > that to be 1.2.${build.number}. Is that possible without overwriting
> > the version number in the pom with every build? For example, by using
> > a "jenkins" profile, which overwrites the project version somehow?
> >
> > Thanks,
> >
> > Jochen
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to