Maven Error: No plugin found for prefix ‘archetype’ in the current project using Nexus - maven

I am trying to setup MAVEN in my company's local network which is not connected to the internet directly. Also I'm using sonatype nexus for my central repository.
Problem starts when I run the command mvn archetype:create. The result is always build failure.
error no plugin found for prefix 'archetype' in the current project.
How do I solve this issue?

Maven is trying to look up the full plugin artifact ID that corresponds the "archetype" prefix.
To do this it reads the available prefixes from this path: /org/apache/maven/plugins/maven-metadata.xml
Since you're using Nexus this is likely coming from a group repository, e.g.:
http://:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-metadata.xml
You'll need to look carefully at your maven configuration and your build log to see where exactly it is trying to retrieve this information. There will likely be additional information about the failure if you run Maven with the debug ("-X") flag.
If it's trying to retrieve it from your Nexus instance see here for information on how to diagnose the issue:
https://support.sonatype.com/entries/21437881

Related

Building Mavenized jCuda with maven

Well I have installed Nvidia driver and cuda 7 successfully and already built and run many jcuda (not mavenized) projects in eclipse.
But I wanted to migrate to the mavenized version one.
So, I cloned this repository and tried to build it. I am on Ubuntu 14.04 x64 and I have set up nexus, too. But when I want to build it with
mvn clean package I got this:
Downloading: http://localhost:8081/nexus/content/groups/public/jcuda/jcublas/0.7.0a/jcublas-0.7.0a.pom
[WARNING] The POM for jcuda:jcublas:jar:0.7.0a is missing, no dependency information available
for all of the *.poms
and after these warnings, the build get finished unsuccessfully with:
Could not resolve dependencies for project org.mystic:mavenized-
jcuda:jar:0.1.2: The following artifacts could not be resolved: jcuda:jcublas:jar:0.7.0a, jcuda:jcuda:jar:0.7.0a ...
and it lists all of the jcuda *.jars and *.sos
Have I forgotten something?
UPDATE:
I used option -Dmaven.repo.local=repo with mvn clean package and every thing is ok.
Yes, I'm 80% sure, that this is because of your local Nexus
Failure to find jcuda:jcublas:jar:0.7.0a in http://localhost:8081/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are force (taken from your log file)
Could you turn it off? It should resolve the issue.
P.S. Current situation with mavenized-jcuda project is, that it takes artifacts from local repo, since this artifacts are not presented in Maven Central or other hosted repositories.
It was nexus problem. And I figured it out in a better way than turn it off.
In the maven settings.xml (~/.m2/settings.xml) the mirrorOf pattern of * causes any repository request to be redirected to this mirror and to my single repository group. Another option is external:* which matches all repositories except those using localhost or file based repositories.
Putting external:* instead of * solved my problem.

Why do I get a 400 when attempting to use publish-plugin from the Grails Release plugin

I'm using Grails 2.4.1 & The Grails Release plugin version 3.0.1.
I have a Sonatype nexus repository (v2.3.1-01) setup that's in use by several other projects with no issues.
I'm attempting to create a new Plugin that I want to distribute through a SNAPSHOT repository in nexus (and later through our Releases repository).
In my ${projectName}GrailsPlugin.groovy file I have:
def groupId ="my-department-grails-plugins"
def version = "0.1-SNAPSHOT"
In my application.properties file I have:
app.name=MyPluginNameForGrails
In my BuildConfig.groovy I have:
grails.project.repos.newsnapshots.url = "http://internal.server.address/nexus/service/local/repositories/snapshots"
grails.project.repos.newsnapshots.username = "username"
grails.project.repos.newsnapshots.password = "password"
I'm trying to kick things off with the following command:
publish-plugin --snapshot --repository=newsnapshots --stacktrace
The build success everything looks good until it trys to push into nexus and I get:
Using configured username and password from
grails.project.repos.newsnapshots ....Error | Failed to publish
plugin: Error deploying artifact
'ald-grails-plugins:my-plugin-name-for-grails:zip': Error deploying
artifact: Failed to transfer file:
http://internal.server.address/nexus/content/groups/public/my-department-grails-plugins/my-plugin-name-for-grails/0.1-SNAPSHOT/my-plugin-name-for-grails-0.1-20140815.191240-1.zip.
Return code is: 400
I've found a related StackOverflow question which seems related but none of the conditions they describe as causing the 400 exist.
I also found the article by Sonatype Nexus which describes possible causes of 400's and those don't seem to be it either.
If you notice the repository that I'm pointing to, it is directly to a repository but then in the error message it lists a path to a group. I am thinking this may be somehow related but but if so... I am not sure how to fix it since this seems to be happening somehow internal to the Releases Plugin.
I should also add that I've removed the -SNAPSHOT from the GrailsPlugin.groovy file and changed the destination repository to be our RELEASES repository with the exact same result.
My problem was due to a mirror defined in my .m2/settings.xml file (thanks Jeff Beck for the comment that led to the resolution!). This was causing the POST to the repository to be redirected to the public GROUP which wasn't allowing the artifact to be uploaded.
There are a few other secondary causes that were contributing to my troubleshooting issues:
While uploading to a SNAPSHOT repository your version number must
be of the pattern x-SNAPSHOT where x can be anything(?).
You cannot upload to a SNAPSHOT repository when using the Nexus ReST
API. This didn't actually end up affecting my specific solution but
it's worth noting for others that may run into this issue.
While uploading to a NON-SNAPSHOT repository your version number must NOT
be of the pattern x-SNAPSHOT.
Given a mirror setting in the .m2 directory the grails release plugin will have issues trying to deploy xif the mirror matches where you are deploying to. You can remove the mirror setting or change it to not match your targeted repo. Check out these jiras for more info:
GPRELEASE-7
GPMAVENPUBLISHER-3

Custom packaging fails nexus release deployment

I'm trying to set up a release plugin in a maven project but it fails at deployment of release artifacts in release:perform. The Nexus repository returns 400 and the maven log tells me that the binary is installed twice to my local repo and then also attempted to be uploaded twice.
I get the feeling that it's related to a custom (3rd party) packaging I'm using - but due to business reason I cannot reveal the name of this.
Anyone that think of a "typical" packaging error that would fool maven to install and deploy the jar twice? other artifacts like javadocs, sources etc do not suffer the sample problem.

How see all maven plugins available in repository?

I work with repository in local network without Internet access. I run build and fall with error because maven can not find a plugin. I can use other plugin but I am not sure that they stored in repository.
It is possible to run some maven command and see all plugins which available in local repository?
I don't think there is a local command to do this. But usually repositories have a web interface that allows you to browser or search.

Trouble with maven in Netbeans

I want to create maven project in Netbeans. So, I do File->New project->Maven->Java Application. After that I try to build the project and get error:
The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available.
But I can build this project from command line with mvn compile. Could uou tell me what is the problem with Netbeans?
NetBeans is using 3.0.4 maven by default. Unless you change that in Tools/Options menu. Are you building with 3.0.4 as well or are you using some earlier versions (2.x)?
That would explain the behaviour because 3.0.4 will not blindly rely on what artifact is in local repository but some additional metadata is also consulted to make sure your project build with the given set of defined repositories.
A common example when the problem occurs to me.
I use central directly everything downloads. when I later add a mirror, all artifacts are checked again through the mirror to make sure they are accessible. if teh Mirror doesn't actually mirror central, I get an error that way.
Another common example is: when building with 2.x, the additional metadata is not written, when later building with 3.0.4, all remote context is checked no matter what is present in local repo and the additional metadata files are constructed.

Resources