How to search with maven plugin in archiva - maven

Using this maven plugin:
http://www.mojohaus.org/versions-maven-plugin/index.html
With this command line:
mvn versions:display-dependency-updates
Maven can connect to Archiva to retrieve the list of dependencies a project is using and check if it uses the latest version of it.
How does it work? Does maven use HTTP to retrieve the information?

We found everything we need there :
Eclipse Aether website

Related

Is there a way to get maven version during a plugin MOJO execution?

I am trying to build a maven plugin which captures basic maven metadata (maven version, java version used by maven during build). How do I get this data inside the plugin ?

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.

Maven Configuration Issue : Failed to find plugin prefix deploy

I am trying to setup Maven(3.2.5) on linux with nexus repo for non Java artifacts. I was going through all the SO questions, and got to know that with Maven command line, one can publish artifacts to repo without POM for non java artifacts.
When I am running maven deploy file command to push non java artifacts(zip file) to nexus repo, and it throws the following error
"Failed to find plugin prefix deploy". I
Here is the pluginGroup tag from my settings.xml, which is under conf dir. How do I get rid of this failed to find plugin error.
Thanks for your time!
<pluginGroups>
<pluginGroup>org.apache.maven.plugins</pluginGroup>
</pluginGroups>
This plugin group tag is not required in setting.xml file. I was not able to download plugin from maven due to firewall issue.
after setting up proxy, I was able to use maven build successfully.

Configuring Maven, jenkins with Sonar

I have installed Jenkins and Sonar, both work fine. I am able to build a maven android project using Jenkins. No i want to run Sonar on the android project. I have installed the Sonar plugin in Jenkins. Configured the sonar module in the configure system module and added a post build task for sonar to run
[ERROR] Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar: Could not find artifact org.codehaus.mojo:sonar-maven-plugin:pom:sonar in nbs-repo (http://10.10.2.89:8081/nexus/content/groups/public/) -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:235)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106)
at
My nexus installation works fine ? What am i doing wrong. My maven pom.xml does not contain any sonar plugin. What am i doing wrong?
Kind Regards
From the error message its clear that mvn is trying to download the sonar-maven-plugin from your local Nexus repository which does not seem to have it.
Try mvn -U in the build in case you already have the plugin.This overrides the negative cache. Another thing is <updatepolicy> in your settings.xml
If you don't have the plugin and neither does your Nexus connect to the internet, you have to manually download and upload in Nexus of course. Please remember to match the version of the plugin with the SONAR installation. Also there would be a few (7-10) transitive dependencies with the plugin which you will need. I suggest using mvn -X or mvn -e to see a verbose output during your testing.

How do I find the latest version of an artifact from a maven repository

As part of an automated deployment I need a script to download the latest version of an artifact from our internal repository.
Ideally this script will be with ant or a unix shell script.
So for example:
I have myArtifact.war and it has versions 1.0 , 1.1 and 2.0 - I need the script given the correct group id and artifact id to retrieve version 2.0 from our maven repository (currently using artifactory).
Is there any easy way to do this?
You can use the Maven Dependency Plugin goal get together with LATEST as version for your artifact:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get
-DremoteRepositories=<URL_to_your_maven_repo>
-Dartifact=<group_id>:<artifact_id>:LATEST
-Dpackaging=jar
-Ddest=<target_dir>/<artifact_name>.jar
You can parse the maven-metadata.xml to see what versions are available, and which version is the "release" version. See this answer about plugin versions for more details.
If you are using Nexus, you can use the REST API to query the repository. You can also use the REST client API to simplify your processing.
To update the release version, activate the release-profile in the Maven super POM when you do mvn deploy. You can do this by adding -Prelease-profile or -DperformRelease=true to the command line.
The profile is activate by default in the maven-release-plugin's perform goal. It is controlled by the useReleaseProfile property. See the release-perform goal's documentation for more details.

Resources