As far as preventing overwrite of an existing remote artifact, you can use the exists-maven-plugin <https://github.com/chonton/exists-maven-plugin>. (https://github.com/chonton/exists-maven-plugin <https://github.com/chonton/exists-maven-plugin>) This plugin will check for the existence of a current artifact and set a property which can be used to ‘skip’ later plugin execution.
By default, this plugin sets the maven.deploy.skip property to false if the current project’s non-snapshot artifact already exists in the remote repository, thus preventing attempted overwrite of final artifacts. You could configure this plugin to set a different property or also prevent SNAPSHOT artifacts from being overwritten. If you have a similar need for install phase, you can create an issue or pull request at this project. chas > On Nov 28, 2016, at 12:11 AM, Hohl, Gerrit <g.h...@aurenz.de> wrote: > > Hello everyone, :-) > > seems my question was an odd one as I didn't get any replies on it. > So maybe I modify it a little bit: > Is it possible - maybe with an own Maven plugin - to check if an artifact is > already in the remote / central repository of my company? > > The goal is the following: > > Each check-in into the SCM triggers a build which builds with "install" on > the Jenkins build server. > Except if that version is already in the central Nexus repository of the > company. > A manually triggered build on the Jenkins build server will build with > "deploy". > Except if that version is already in the central Nexus repository of the > company. > > This way always the newest version of an artifact would be available for > other artifact build processes which depend on it. > But versions which have been already "released" wouldn't be changed / > overwritten. > Otherwise they would change on the build server because someone forgot to > change the version and break other builds on that machine. > > Does someone of you know if it is possible to realize something like that > with already existing (and still maintained / developed) plugins? > Or how a programmatically solution could look like? Means does someone know > what the Maven classes for accessing the remote repository are? > > Regards, > Gerrit > -----Ursprüngliche Nachricht----- > Von: Hohl, Gerrit [mailto:g.h...@aurenz.de] > Gesendet: Freitag, 18. November 2016 08:48 > An: users@maven.apache.org > Betreff: Don't overwrite existing artifact - how? > > Hello everyone, :-) > > > > is it somehow possible not to "install" an artifact which already exists in > the local repository? > > What about artifacts in a remote repository? Is it possible to prevent > deployment of such artifacts? > > > > I don't want to have our build server to accidentally install an artifact a > second time just because someone forgot to change the version. > > Even if that artifact isn't deployed to the remote repository it will be used > on that build server. > > In the maven-install-plugin description there is no option. But who knows... > > > > I saw that there is the possibility in Nexus to prevent redeployement for a > repository. > > Is there also a way within Maven? Or not because Maven says it's the job of > the repository server / service itself. > > In the maven-deploy-plugin description there is no option. But who knows... > > > > Regards, > > Gerrit > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org >