You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Hohl, Gerrit" <g....@aurenz.de> on 2016/11/18 07:48:23 UTC

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

 


Re: Don't overwrite existing artifact - how?

Posted by Charles Honton <ch...@honton.org>.
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.

chas

> On Nov 17, 2016, at 11:48 PM, Hohl, Gerrit <g....@aurenz.de> wrote:
> 
> 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
> 
> 
> 


AW: Don't overwrite existing artifact - how?

Posted by "Hohl, Gerrit" <g....@aurenz.de>.
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:chas@honton.org] 
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 <g....@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.hohl@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


Re: Don't overwrite existing artifact - how?

Posted by Charles Honton <ch...@honton.org>.
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....@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.hohl@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


Re: Don't overwrite existing artifact - how?

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,
I understand that this is not what you are asking for, but normally you would not allow to overwrite artifacts in the release repository. This way it cannot happen that a forgotten version Update overwrites released artifacts.
For snapshot artifacts on the other side you get a new timestamp (which is usually what you want since otherwise the artifacts might be outdated).
I can understand where you are coming from with your question, but I would keep it simple: have the developer specify a version when you use the release plugin (via CI server support). If you are planning to create unique versions for each CI build job, you can do that as well. In both cases your repo will protect you from overwriting artifacts.

Gruss
Bernd
-- 
http://bernd.eckenfels.net




On Mon, Nov 28, 2016 at 9:11 AM +0100, "Hohl, Gerrit" <g....@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.hohl@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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org







AW: Don't overwrite existing artifact - how?

Posted by "Hohl, Gerrit" <g....@aurenz.de>.
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.hohl@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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org