How do I prevent/delete old packages in gitlab maven repository - maven

I have a java project built with gradle, that publishes to a GitLab maven repository. The gitlab maven documentation claims the following:
When you publish a package with the same name or version as an existing package,
the existing package is overwritten.
But this does not happen. The repository is filling up with old versions of the same package. How can I prevent this from happening and/or delete the old package versions in the repository?

Related

How do I get gradle to update .gradle/caches from my local .m2 repository?

I have a common project built with gradle. When I do a gradle clean install it installs the newest .jar file in my local .m2 repository. The .gradle/caches still contains the old version of the library, however, which is what gradle and Intellij uses. This prevents me from testing the changes I've made to the common library locally.
Using --refresh-dependencies doesn't help because it pulls the old version from a remote repository instead of from my .m2 repo. I had to manually copy the new library file from my .m2 repository to .gradle/caches in order to test the changes.
Maybe there is a use case where having a local .m2 repository and a cache makes sense, but it doesn't for testing library changes locally. Is there a way to get gradle to install the new version in .gradle/caches so I can test my changes before publishing them to our repository?

How to update maven package after commit/pull-request

I am using a package https://github.com/dhatim/fastexcel, resently there was a commit in their repo, but the version had not been changed in Readme(description) of package in git hub, how can I update the package using maven?
I tried to run mvn release:update-versions, but I get this error
Then I run mvn release:update-versions -X
This is my pom.xml
The git repo is not equal the maven lib. You download maven libraries from the offical maven repository. The maintainer of the library needs to upload his artifact to the central repository when he builds a new release after that you can use this.
To see which version is usable you can use a maven search website like https://search.maven.org.
The dependency org.dhatim:fastexcel has a version 0.9.4 (same as the github release).
So it seems the developer already uploaded it but did not correct his Readme in the repository. So you can just use 0.9.4 in your pom.xml.
So always check the maven search site and if something is missing you can always add an issue to github to ask the developer uploading it.
There are also this more or less recommended possibilites to get library as a workaround:
Checkout and build the project by your self and add the jar file to:
something like nexus as own repository hosting (a organization normally has a maven proxy which could be used)
add it to the pom.xml as system scope dependency where the jar must be located on your system
use mvn install on the fastexcel project and change the version in your pom.xml to 0-SNAPSHOT

Sbt do not update snapshot in Local maven repo

I have a project that is based on maven, and in which I am integrating some libraries that I am developing in Scala using SBT.
Currently the SBT project (in which I am developing the Lib) has a snapshot version.
While the snapshot jar is well updated in Ivy correctly it is not the case in Maven when I use PublishM2. I have to delete the previous one to get to have the new version that I would publish with PublishM2.
Is there a way to ensure that my PublishM2 update the local Maven repository properly (meaning with a new snapshot)?
Try the following sbt command:
sbt publishLocal publishM2
It should publish artifact into local Maven repository.

Importing a snapshot version of a dependency into Maven repository

I am having trouble importing dependencies for my Grails project into the company Nexus repository. The Grails plugin I would like to use is events-push (https://github.com/smaldini/grails-events-push). The latest released version of the plugin is 1.0.M7. It uses a very old version of Atmosphere library. The GutHub repository contains a more up-to-date version of events-push plugin, 1.0.0.BUILD-SNAPSHOT. I built the Grails plugin from the local clone of the repository and got it to work in my dev environment.
To deploy it on the intranet (in the production environment) I need to import all the plugin dependencies into the company Nexus repository. This is where I run into trouble. The project depends on a SNAPSHOT version of events-push plugin, which in turn depends on SNAPSHOT version of other Grails plugins and Java libraries (according to dependency report).
Nexus supports two types of repositories, Release and Snapshot. I can add artifacts to a Release repository (through the browser UI or in a batch mode using curl), but the artifact must not be a snapshot. I can change the repository to be a Snapshot repository, but then I lose the ability to add artifact to it through the browser or curl command.
How do I make these SNAPSHOT artifacts available to the Grails project through Maven?
Change them to a release version and deploy them to the release repository.

Share Maven Dependencies with team members using Mercurial

I want to share all the External Jars currently being managed by MAVEN with my other team members. I am using Mercurial as my SCM and i am trying to figure what is the easiest way to commit my entire project (include libs) to a repository so that my team members can clone and get running without severe eclipse configuration?
Maven is there in order to help you retrieving libraries. So that, all you have to do is to commit all your files including the pom.xml (.hg should contains everything in target, and other unrelevant files)
Then your project members can pull the sources and run mvn eclipse:eclipse (see eclipse & maven.
And finally import the project in Eclipse.
That was is they need sources...
If they only need the jars, you must put in your infrastructure a company repo that will handle your deployment using mvn deploy. Some information there maven repo::Intro, take special care at the wagon you could use (ftp, ...)
This way, when you're done with your devel and you have pushed your code, you just have to deploy the jar on your repo.
Doing so, your project member'll have to run mvn -U eclipse:eclipse or any goal to update their local repository with your lastest deployed version.

Resources