Gradle Dependency Management: latest.integration vs. latest.release - gradle

I just came across a small question concerning Gradle's dependency management.
I know that I can declare dependencies using latest.integration to reference snapshots or use latest.release to reference artifacts from release builds.
My question is:
Does latest.integration exclusively and only refer the latest SNAPSHOT artifacts or will latest.integration resolve using a release artifact, if the latest release artefact has a higher version than the latest from integration?
Example:
latest snapshot artifact: 2.1
latest release artifact: 2.2
If using latest.integration, which one will be used to resolve the dependency?
If its the case that latest.integration also integrates release artifacts, by which rule can I explicitly refer to snapshot artifacts?

latest.integration resolves to latest snapshot or release, whichever is newer. There is no symbolic version for latest snapshot only (use 1.2.3-SNAPSHOT).

Related

How to increase snapshot version or release version automatically through maven

How to increase snapshot version or release version automatically through maven. I am aware we could use maven goals such as release:prepare or release:update-versions. But i have a scenario where my snapshot version or release version should increment automatically for each build. Should we add any custom line code in pom.. please suggest me a solution.

why does maven check for updates when I have specified a version?

I have trouble understanding, why maven has to check for updates each time we build a project.
The pom has specific version mentioned for each dependency. Once those versions are downloaded to the local repo, then maven can use that local copy to build the project. So why does maven have to check for updates when we build the project each time other than just using the local copy?
a side question.
can a maven artifact be changed after releasing it to a repo under a specific version?
As per Maven, an artifact mainly can be of two types - a RELEASE one and a SNAPSHOT one. RELEASE dependency(eg: 1.0.1, 2.3.0 etc) of an artifact is a source of truth. Means 1.0.1 version of a jar (say test.jar) will always be the same always. We will release artifacts to remote repository, whenever the product matures or after a sequence of bug fixes.
On the other hand, a development is on going in a project, then specified its version number as SNAPSHOT(eg: 2.0-SNAPSHOT, 1.1-SNAPSHOT etc).
Say if we specified test-2.0-SNAPSHOT.jar as dependency in our project pom. If we look at the remote repository (Nexus, archiva etc), we can see that it is not saved as version 2.0-SNAPSHOT rather it will be saved artifact version as date-timestamp-buildnumber format, the date-timestamp at which the artifact was built and uploaded to remote repo. (eg: test-2.0-20150105082634.jar)
So when ever the development team does the fix for an issue on a daily basis the updated jar with date timestamp will be in uploaded to the remote repo. So it is necessary for maven to do look up for the latest date timestamp of SNAPSHOT artifacts. Maven does this by maven-metadata.xml file in the artifact directory in the repo.
Hope this clarifies your query. Let me know, if you need any clarifications

what is dependency for Sonar-plugins in POM

We have upgraded SonarQube from version 3.7.2 to 4.5.5. We are using maven to
build and deployment.
There are some plugins need to be updated. But, I am not sure whether, I am not able to find the exact GAV parameter for them or to find latest version using POM.
e.g Build-stability-plugin; I am not able to find version 1.3 for this plugin on maven repository.
Any kind of help will be appreciated
You mix Maven plugins and SonarQube plugins. The latter doesn't need to be deployed in Maven repository nor to be defined in project poms.

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.

Sonatype Nexus OSS using LATEST in pom.xml gives unresolved dependency (maven2)

I have a Sonatype Nexus OSS install, and I have artifacts on it. However, when using "LATEST" for the version in the pom.xml, I get an unresolved dependency error. Is there something I have to enable to allow the LATEST keyword? I've looked everywhere
The Maven client does not true support dynamic revisions. The closest thing it supports are snapshot revisions, where a revision like 1.0-SNAPSHOT, is resolved to the latest time-stamped artifact.
I think you may be confusing the Maven POM with the REST API used by Nexus. This the ability to specify a "LATEST" version:
https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST&e=jar

Resources