How to create a repository snapshot pruner mojo?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create a repository snapshot pruner mojo?

Steinar Bang
I'm deploying maven snapshots from travis CI-builds, to a "low-cost" (in
terms of server resources) repository, consisting of an ftp server, and
served out with nginx.

I would like to clean up the snapshots, so that only the most recent
snapshot of each artifact is kept.  

I'm thinking that the best way would be if a plugin could clean up after
the deploy in the maven build, preferably when everything about the
remote repository (ie. the maven-metadata.xml files) already is parsed,
and in memory, and accessible through some API.

I have googled for such a plugin, but I haven't found any.  The closest
I've got, is this stack overflow thread:
 https://stackoverflow.com/questions/12572037/purge-maven-local-repository-and-keep-latest

But the solutions mentioned in the stack overflow are all for the local
maven repository. I haven't found any plugins that can do cleanup on a
remote repository accessible through the wagon API.

So I've toyed with the idea of writing a mojo to do snapshot pruning
myself.

However, it's hard to find code examples and pointers to the relevant
APIs.  At least just using google.

What I'm looking for initially, is this:
 - What API classes and methods to use to get at the information from
   maven-metadata.xml files for the current project artifact?
 - What API classes and methods to use to list remote files for a
   deployed artifact
 - What API classes and methods to use to delete remote files for a
   deployed artifact

All pointers and suggestions are appreciated!

Thanks!


- Steinar


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to create a repository snapshot pruner mojo?

Robert Scholte-6
Hi Steinar,

as you have discovered, a remote repository must be managed. IIRC the  
first version of Maven Central had a setup comparable to yours. Nowadays  
that is just not suitable anymore.

please read the following pages:
https://maven.apache.org/guides/introduction/introduction-to-repositories.html
https://maven.apache.org/repository-management.html

So instead of FTP hosting, try to find Maven Repository hosting.
They have already solved the problems you're facing right now.

thanks,
Robert

On Sat, 26 Aug 2017 13:17:32 +0200, Steinar Bang <[hidden email]> wrote:

> I'm deploying maven snapshots from travis CI-builds, to a "low-cost" (in
> terms of server resources) repository, consisting of an ftp server, and
> served out with nginx.
>
> I would like to clean up the snapshots, so that only the most recent
> snapshot of each artifact is kept.
>
> I'm thinking that the best way would be if a plugin could clean up after
> the deploy in the maven build, preferably when everything about the
> remote repository (ie. the maven-metadata.xml files) already is parsed,
> and in memory, and accessible through some API.
>
> I have googled for such a plugin, but I haven't found any.  The closest
> I've got, is this stack overflow thread:
>  https://stackoverflow.com/questions/12572037/purge-maven-local-repository-and-keep-latest
>
> But the solutions mentioned in the stack overflow are all for the local
> maven repository. I haven't found any plugins that can do cleanup on a
> remote repository accessible through the wagon API.
>
> So I've toyed with the idea of writing a mojo to do snapshot pruning
> myself.
>
> However, it's hard to find code examples and pointers to the relevant
> APIs.  At least just using google.
>
> What I'm looking for initially, is this:
>  - What API classes and methods to use to get at the information from
>    maven-metadata.xml files for the current project artifact?
>  - What API classes and methods to use to list remote files for a
>    deployed artifact
>  - What API classes and methods to use to delete remote files for a
>    deployed artifact
>
> All pointers and suggestions are appreciated!
>
> Thanks!
>
>
> - Steinar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]