Re: How can I emit the SNAPSHOT version after deploy?
Thanks for all the suggestions. I've not been successful yet in updating the POM to get what I need. The deploy seems to assign a new snapshot id (timestamp+iteration) independent of what is set in the project. My most successful attempt so far is to not worry about it in the POM, but instead immediately use the RestAPI for Nexus OSS with the GAV coordinates and the resulting XML (or JSON) contains all the information I need. I'm currently working on a Groovy script that will take the JSON and set Jenkins Job environment variables. FYI, the RestAPI looks like: http:// /nexus/service/local/artifact/maven/resolve?r=&g=$POM_GROUPID&a=$POM_ARTIFACTID&v=$POM_VERSION&e=$POM_PACKAGING Where the $POM_** variables are the maven coordinates that are set in a Jenkins environment for a Maven job. The json result looks like: { "data": { "presentLocally": true, "groupId": "", "artifactId": "", "version": "", "baseVersion": "", "extension": "", "snapshot": true, "snapshotBuildNumber": 120, "snapshotTimeStamp": 1440115538000, "sha1": "af6be177f975966800777d62afd3081f412b4286", "repositoryPath": "///-." } } This is everything I need/want so hopefully I can figure out how to set Jenkins job settings. ;) -Jeff On Mon, Aug 24, 2015 at 7:51 AM, Ben Podgursky wrote: > Ok I'll stop spamming after this. > > Try ${maven.build.timestamp}, seems like it might already be the same > snapshot as the timestamp and set by maven. ( > https://dzone.com/articles/stamping-version-number-and) > > On Mon, Aug 24, 2015 at 6:44 AM, Ben Podgursky > wrote: > > > ack, actually that isn't the snapshot version, it's the git commit. But > > it's the closest thing I know of. > > > > On Mon, Aug 24, 2015 at 6:42 AM, Ben Podgursky > > wrote: > > > >> Sorry for the late response, > >> > >> I think you can use this plugin: > >> https://github.com/code54/buildversion-plugin > >> > >> "build-version" property will be the snapshot version. > >> > >> On Mon, Aug 24, 2015 at 1:52 AM, Gerd Aschbrenner < > >> gaschbren...@picturesafe.de> wrote: > >> > >>> Hi Jeff, > >>> I have no answer for your question, but maybe I have got a solution for > >>> your problem. > >>> > >>> But you will be limited to only one running instance of your Jenkins > >>> build pipeline. > >>> > >>> Take a look at the plugins: > >>> * Copy Artifact Plugin > >>> * Clean Workspace Plugin > >>> > >>> 1. Build your "myapp" with Jenkins > >>> 2. Add the post build action "Archive Artifact" > >>> 3. In the downstream project add a build step "Copy artifact from > >>> another project" > >>> > >>> Now the artifact is in your workspace and you can work with it. > >>> > >>> > >>> So what about the "Clean Workspace plugin"? > >>> It is for stability. You can use it to clean the whole workspace (or > >>> only the copied artifact of the previous build) before copying the > artifact > >>> into your downstream project. > >>> This will ensure using a fresh copy of the artifact and not any old > >>> (cached) build of it. > >>> > >>> > >>> I use this plugins to collect some "last stable" artifacts from > >>> different Jenkins projects and copy them to a test environment > >>> (publish-over-ssh plugin). > >>> > >>> > >>> Regards > >>>Gerd > >>> > >>> > >>> > >>> Am 21.08.2015 um 17:08 schrieb Jeff: > >>> > I should clarify that I want to find the specific SNAPSHOT version > assigned > by Nexus (or other maven repository manager applications) after the > deploy. > > So after I deploy 'myapp.jar' to Nexus with GAV: > > groupID: mycompany.com > artifactID: myapp > version: 1.0-SNAPSHOT > > > Nexus assigns it to something > like > /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar > > I want to get the "20150821.000538-120" portion and also if possible > the > SHA1 hash Nexus generated. > > Thanks! > > > On Fri, Aug 21, 2015 at 8:37 AM, Jeff wrote: > > In implementing a continuous deployment pipeline I would like to > update > > my > > configuration tool with the specific SNAPSHOT version produced during > > the > > 'deploy' phase of the build. > > > > Ideally, I'd like to set an environment variable so that in Jenkins I > > can > > use it to trigger the downstream build. Alternatively a file or > > something > > will work > > > > I've been searching Google and digging through the archives, but I > > haven't > > found a way yet. > > > > Is there a way to do this somehow using existing plugins or Maven > > conventions? > > > > Thanks! > > > > -- > > Jeff Vincent > > See my LinkedIn profile at: > > http://www.linkedin.com/in/rjeffreyvincent > > > > > > >>> > >>> > >>> > >>> - > >>> To
Re: How can I emit the SNAPSHOT version after deploy?
Ok I'll stop spamming after this. Try ${maven.build.timestamp}, seems like it might already be the same snapshot as the timestamp and set by maven. ( https://dzone.com/articles/stamping-version-number-and) On Mon, Aug 24, 2015 at 6:44 AM, Ben Podgursky wrote: > ack, actually that isn't the snapshot version, it's the git commit. But > it's the closest thing I know of. > > On Mon, Aug 24, 2015 at 6:42 AM, Ben Podgursky > wrote: > >> Sorry for the late response, >> >> I think you can use this plugin: >> https://github.com/code54/buildversion-plugin >> >> "build-version" property will be the snapshot version. >> >> On Mon, Aug 24, 2015 at 1:52 AM, Gerd Aschbrenner < >> gaschbren...@picturesafe.de> wrote: >> >>> Hi Jeff, >>> I have no answer for your question, but maybe I have got a solution for >>> your problem. >>> >>> But you will be limited to only one running instance of your Jenkins >>> build pipeline. >>> >>> Take a look at the plugins: >>> * Copy Artifact Plugin >>> * Clean Workspace Plugin >>> >>> 1. Build your "myapp" with Jenkins >>> 2. Add the post build action "Archive Artifact" >>> 3. In the downstream project add a build step "Copy artifact from >>> another project" >>> >>> Now the artifact is in your workspace and you can work with it. >>> >>> >>> So what about the "Clean Workspace plugin"? >>> It is for stability. You can use it to clean the whole workspace (or >>> only the copied artifact of the previous build) before copying the artifact >>> into your downstream project. >>> This will ensure using a fresh copy of the artifact and not any old >>> (cached) build of it. >>> >>> >>> I use this plugins to collect some "last stable" artifacts from >>> different Jenkins projects and copy them to a test environment >>> (publish-over-ssh plugin). >>> >>> >>> Regards >>>Gerd >>> >>> >>> >>> Am 21.08.2015 um 17:08 schrieb Jeff: >>> I should clarify that I want to find the specific SNAPSHOT version assigned by Nexus (or other maven repository manager applications) after the deploy. So after I deploy 'myapp.jar' to Nexus with GAV: groupID: mycompany.com artifactID: myapp version: 1.0-SNAPSHOT Nexus assigns it to something like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar I want to get the "20150821.000538-120" portion and also if possible the SHA1 hash Nexus generated. Thanks! On Fri, Aug 21, 2015 at 8:37 AM, Jeff wrote: In implementing a continuous deployment pipeline I would like to update > my > configuration tool with the specific SNAPSHOT version produced during > the > 'deploy' phase of the build. > > Ideally, I'd like to set an environment variable so that in Jenkins I > can > use it to trigger the downstream build. Alternatively a file or > something > will work > > I've been searching Google and digging through the archives, but I > haven't > found a way yet. > > Is there a way to do this somehow using existing plugins or Maven > conventions? > > Thanks! > > -- > Jeff Vincent > See my LinkedIn profile at: > http://www.linkedin.com/in/rjeffreyvincent > > >>> >>> >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >>> For additional commands, e-mail: users-h...@maven.apache.org >>> >> >> >
Re: How can I emit the SNAPSHOT version after deploy?
ack, actually that isn't the snapshot version, it's the git commit. But it's the closest thing I know of. On Mon, Aug 24, 2015 at 6:42 AM, Ben Podgursky wrote: > Sorry for the late response, > > I think you can use this plugin: > https://github.com/code54/buildversion-plugin > > "build-version" property will be the snapshot version. > > On Mon, Aug 24, 2015 at 1:52 AM, Gerd Aschbrenner < > gaschbren...@picturesafe.de> wrote: > >> Hi Jeff, >> I have no answer for your question, but maybe I have got a solution for >> your problem. >> >> But you will be limited to only one running instance of your Jenkins >> build pipeline. >> >> Take a look at the plugins: >> * Copy Artifact Plugin >> * Clean Workspace Plugin >> >> 1. Build your "myapp" with Jenkins >> 2. Add the post build action "Archive Artifact" >> 3. In the downstream project add a build step "Copy artifact from another >> project" >> >> Now the artifact is in your workspace and you can work with it. >> >> >> So what about the "Clean Workspace plugin"? >> It is for stability. You can use it to clean the whole workspace (or only >> the copied artifact of the previous build) before copying the artifact into >> your downstream project. >> This will ensure using a fresh copy of the artifact and not any old >> (cached) build of it. >> >> >> I use this plugins to collect some "last stable" artifacts from different >> Jenkins projects and copy them to a test environment (publish-over-ssh >> plugin). >> >> >> Regards >>Gerd >> >> >> >> Am 21.08.2015 um 17:08 schrieb Jeff: >> >>> I should clarify that I want to find the specific SNAPSHOT version >>> assigned >>> by Nexus (or other maven repository manager applications) after the >>> deploy. >>> >>> So after I deploy 'myapp.jar' to Nexus with GAV: >>> >>> groupID: mycompany.com >>> artifactID: myapp >>> version: 1.0-SNAPSHOT >>> >>> >>> Nexus assigns it to something >>> like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar >>> >>> I want to get the "20150821.000538-120" portion and also if possible the >>> SHA1 hash Nexus generated. >>> >>> Thanks! >>> >>> >>> On Fri, Aug 21, 2015 at 8:37 AM, Jeff wrote: >>> >>> In implementing a continuous deployment pipeline I would like to update my configuration tool with the specific SNAPSHOT version produced during the 'deploy' phase of the build. Ideally, I'd like to set an environment variable so that in Jenkins I can use it to trigger the downstream build. Alternatively a file or something will work I've been searching Google and digging through the archives, but I haven't found a way yet. Is there a way to do this somehow using existing plugins or Maven conventions? Thanks! -- Jeff Vincent See my LinkedIn profile at: http://www.linkedin.com/in/rjeffreyvincent >>> >> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> > >
Re: How can I emit the SNAPSHOT version after deploy?
Sorry for the late response, I think you can use this plugin: https://github.com/code54/buildversion-plugin "build-version" property will be the snapshot version. On Mon, Aug 24, 2015 at 1:52 AM, Gerd Aschbrenner < gaschbren...@picturesafe.de> wrote: > Hi Jeff, > I have no answer for your question, but maybe I have got a solution for > your problem. > > But you will be limited to only one running instance of your Jenkins build > pipeline. > > Take a look at the plugins: > * Copy Artifact Plugin > * Clean Workspace Plugin > > 1. Build your "myapp" with Jenkins > 2. Add the post build action "Archive Artifact" > 3. In the downstream project add a build step "Copy artifact from another > project" > > Now the artifact is in your workspace and you can work with it. > > > So what about the "Clean Workspace plugin"? > It is for stability. You can use it to clean the whole workspace (or only > the copied artifact of the previous build) before copying the artifact into > your downstream project. > This will ensure using a fresh copy of the artifact and not any old > (cached) build of it. > > > I use this plugins to collect some "last stable" artifacts from different > Jenkins projects and copy them to a test environment (publish-over-ssh > plugin). > > > Regards >Gerd > > > > Am 21.08.2015 um 17:08 schrieb Jeff: > >> I should clarify that I want to find the specific SNAPSHOT version >> assigned >> by Nexus (or other maven repository manager applications) after the >> deploy. >> >> So after I deploy 'myapp.jar' to Nexus with GAV: >> >> groupID: mycompany.com >> artifactID: myapp >> version: 1.0-SNAPSHOT >> >> >> Nexus assigns it to something >> like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar >> >> I want to get the "20150821.000538-120" portion and also if possible the >> SHA1 hash Nexus generated. >> >> Thanks! >> >> >> On Fri, Aug 21, 2015 at 8:37 AM, Jeff wrote: >> >> In implementing a continuous deployment pipeline I would like to update my >>> configuration tool with the specific SNAPSHOT version produced during the >>> 'deploy' phase of the build. >>> >>> Ideally, I'd like to set an environment variable so that in Jenkins I can >>> use it to trigger the downstream build. Alternatively a file or >>> something >>> will work >>> >>> I've been searching Google and digging through the archives, but I >>> haven't >>> found a way yet. >>> >>> Is there a way to do this somehow using existing plugins or Maven >>> conventions? >>> >>> Thanks! >>> >>> -- >>> Jeff Vincent >>> See my LinkedIn profile at: >>> http://www.linkedin.com/in/rjeffreyvincent >>> >>> >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org >
Re: How can I emit the SNAPSHOT version after deploy?
Hi Jeff, I have no answer for your question, but maybe I have got a solution for your problem. But you will be limited to only one running instance of your Jenkins build pipeline. Take a look at the plugins: * Copy Artifact Plugin * Clean Workspace Plugin 1. Build your "myapp" with Jenkins 2. Add the post build action "Archive Artifact" 3. In the downstream project add a build step "Copy artifact from another project" Now the artifact is in your workspace and you can work with it. So what about the "Clean Workspace plugin"? It is for stability. You can use it to clean the whole workspace (or only the copied artifact of the previous build) before copying the artifact into your downstream project. This will ensure using a fresh copy of the artifact and not any old (cached) build of it. I use this plugins to collect some "last stable" artifacts from different Jenkins projects and copy them to a test environment (publish-over-ssh plugin). Regards Gerd Am 21.08.2015 um 17:08 schrieb Jeff: I should clarify that I want to find the specific SNAPSHOT version assigned by Nexus (or other maven repository manager applications) after the deploy. So after I deploy 'myapp.jar' to Nexus with GAV: groupID: mycompany.com artifactID: myapp version: 1.0-SNAPSHOT Nexus assigns it to something like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar I want to get the "20150821.000538-120" portion and also if possible the SHA1 hash Nexus generated. Thanks! On Fri, Aug 21, 2015 at 8:37 AM, Jeff wrote: In implementing a continuous deployment pipeline I would like to update my configuration tool with the specific SNAPSHOT version produced during the 'deploy' phase of the build. Ideally, I'd like to set an environment variable so that in Jenkins I can use it to trigger the downstream build. Alternatively a file or something will work I've been searching Google and digging through the archives, but I haven't found a way yet. Is there a way to do this somehow using existing plugins or Maven conventions? Thanks! -- Jeff Vincent See my LinkedIn profile at: http://www.linkedin.com/in/rjeffreyvincent - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How can I emit the SNAPSHOT version after deploy?
That could be a backup option but I'd definitely prefer to have it done as part of the same build step. Thanks for the suggestion. On Fri, Aug 21, 2015 at 11:15 AM, Jörg Schaible < joerg.schai...@swisspost.com> wrote: > Hi Jeff, > > Jeff wrote: > > > I should clarify that I want to find the specific SNAPSHOT version > > assigned by Nexus (or other maven repository manager applications) after > > the deploy. > > > > So after I deploy 'myapp.jar' to Nexus with GAV: > > > > groupID: mycompany.com > > artifactID: myapp > > version: 1.0-SNAPSHOT > > > > > > Nexus assigns it to something > > like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar > > > > I want to get the "20150821.000538-120" portion and also if possible the > > SHA1 hash Nexus generated. > > What happens if you use dependency:get to "download" the SNAPHSOT? You > might > find it then in your local repository as timestamped version (depending on > your settings in updatePolicy ("always") for the snapshot repo). > > Cheers, > Jörg > > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Jeff Vincent See my LinkedIn profile at: http://www.linkedin.com/in/rjeffreyvincent
Re: How can I emit the SNAPSHOT version after deploy?
Hi Jeff, Jeff wrote: > I should clarify that I want to find the specific SNAPSHOT version > assigned by Nexus (or other maven repository manager applications) after > the deploy. > > So after I deploy 'myapp.jar' to Nexus with GAV: > > groupID: mycompany.com > artifactID: myapp > version: 1.0-SNAPSHOT > > > Nexus assigns it to something > like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar > > I want to get the "20150821.000538-120" portion and also if possible the > SHA1 hash Nexus generated. What happens if you use dependency:get to "download" the SNAPHSOT? You might find it then in your local repository as timestamped version (depending on your settings in updatePolicy ("always") for the snapshot repo). Cheers, Jörg - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How can I emit the SNAPSHOT version after deploy?
Not possible at this moment, I ended up to download the maven-metadata.xml and extract the info after deploy. However, I do believe this is a good enhancement for maven-deploy-plugin, please file enhancement request for it -Dan On Fri, Aug 21, 2015 at 8:08 AM, Jeff wrote: > I should clarify that I want to find the specific SNAPSHOT version assigned > by Nexus (or other maven repository manager applications) after the deploy. > > So after I deploy 'myapp.jar' to Nexus with GAV: > > groupID: mycompany.com > artifactID: myapp > version: 1.0-SNAPSHOT > > > Nexus assigns it to something > like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar > > I want to get the "20150821.000538-120" portion and also if possible the > SHA1 hash Nexus generated. > > Thanks! > > > On Fri, Aug 21, 2015 at 8:37 AM, Jeff wrote: > > > In implementing a continuous deployment pipeline I would like to update > my > > configuration tool with the specific SNAPSHOT version produced during the > > 'deploy' phase of the build. > > > > Ideally, I'd like to set an environment variable so that in Jenkins I can > > use it to trigger the downstream build. Alternatively a file or > something > > will work > > > > I've been searching Google and digging through the archives, but I > haven't > > found a way yet. > > > > Is there a way to do this somehow using existing plugins or Maven > > conventions? > > > > Thanks! > > > > -- > > Jeff Vincent > > See my LinkedIn profile at: > > http://www.linkedin.com/in/rjeffreyvincent > > > > > > -- > Jeff Vincent > See my LinkedIn profile at: > http://www.linkedin.com/in/rjeffreyvincent >
Re: How can I emit the SNAPSHOT version after deploy?
Hello Jeff I also wanted to do something similar a while ago. But in my attempt in a multi-modules project, each modules got a slightly different timestamp. Building from the root of a project having modules A, B and C gave me the following timestamps: A: 20150702.165421-17 B: 20150702.165432-17 C: 20150702.165454-17 It looks like that Maven generates an individual timestamp from the time at which each sub-module is built, instead that a unique timestamp for the whole project. This make difficult the usage of a single property for the timestamp portion if the project has more than one module. Martin Le 21/08/15 11:08, Jeff a écrit : > I should clarify that I want to find the specific SNAPSHOT version assigned > by Nexus (or other maven repository manager applications) after the deploy. > > So after I deploy 'myapp.jar' to Nexus with GAV: > > groupID: mycompany.com > artifactID: myapp > version: 1.0-SNAPSHOT > > > Nexus assigns it to something > like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar > > I want to get the "20150821.000538-120" portion and also if possible the > SHA1 hash Nexus generated. > > Thanks!
Re: How can I emit the SNAPSHOT version after deploy?
I should clarify that I want to find the specific SNAPSHOT version assigned by Nexus (or other maven repository manager applications) after the deploy. So after I deploy 'myapp.jar' to Nexus with GAV: groupID: mycompany.com artifactID: myapp version: 1.0-SNAPSHOT Nexus assigns it to something like /com/mycompany/myapp/1.0-SNAPSHOT/myapp-1.0-20150821.000538-120.jar I want to get the "20150821.000538-120" portion and also if possible the SHA1 hash Nexus generated. Thanks! On Fri, Aug 21, 2015 at 8:37 AM, Jeff wrote: > In implementing a continuous deployment pipeline I would like to update my > configuration tool with the specific SNAPSHOT version produced during the > 'deploy' phase of the build. > > Ideally, I'd like to set an environment variable so that in Jenkins I can > use it to trigger the downstream build. Alternatively a file or something > will work > > I've been searching Google and digging through the archives, but I haven't > found a way yet. > > Is there a way to do this somehow using existing plugins or Maven > conventions? > > Thanks! > > -- > Jeff Vincent > See my LinkedIn profile at: > http://www.linkedin.com/in/rjeffreyvincent > -- Jeff Vincent See my LinkedIn profile at: http://www.linkedin.com/in/rjeffreyvincent
How can I emit the SNAPSHOT version after deploy?
In implementing a continuous deployment pipeline I would like to update my configuration tool with the specific SNAPSHOT version produced during the 'deploy' phase of the build. Ideally, I'd like to set an environment variable so that in Jenkins I can use it to trigger the downstream build. Alternatively a file or something will work I've been searching Google and digging through the archives, but I haven't found a way yet. Is there a way to do this somehow using existing plugins or Maven conventions? Thanks! -- Jeff Vincent See my LinkedIn profile at: http://www.linkedin.com/in/rjeffreyvincent