Hello Bernd,
Hello Chas,

thanks for your mails.

@Bernd:
The problem is that we have some old projects which definitely overwrite their 
artifacts in the repository.
Unfortunately I can't change that at the moment and also not in the near future 
as I don't have enough time for that.
Also I'm aware that this - let's say - not optimal (don't want that mail being 
filtered by using some swearwords). ;-)
If I use SNAPSHOT I have to change that at some point - manually or 
automatically.
And I have to keep that somehow in sync with other projects and version tags in 
the SCM.
Same if I include the build number into the version.
That's why I came up with that idea I described - also I know that this also 
has some cons (like changing the version by hand - if needed).
And even after working with Maven for ~4 years and also reading books like the 
famous "Continuous Deliver" I haven't found out a real smooth way to implement 
a build and version process which has no cons at all.

@Chas:
Your plugin was exactly what I was looking for. :-)
That one and the Apache Maven Enforcer plugin (Require Property rule) seem to 
do the trick - also I haven't tested it yet.

Regards
Gerrit


-----Ursprüngliche Nachricht-----
Von: Charles Honton [mailto:[email protected]] 
Gesendet: Montag, 28. November 2016 16:25
An: Maven Users List
Betreff: Re: Don't overwrite existing artifact - how?

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 <[email protected]> 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:[email protected]] 
> Gesendet: Freitag, 18. November 2016 08:48
> An: [email protected]
> 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: [email protected]
> For additional commands, e-mail: [email protected]
> 

Reply via email to