问题
I have a problem, I need to use Maven version 3.3.3 in offline mode. I set the conf file settings.xml to work offline and use the command mvn --offline ecc...
But when i type the command: mvn archetype:generate
I see the following error:
[...] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\xxx\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1] org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\xxx\.m2\repository), central (https://repo.maven.apache.org/maven2)] at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:93) at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:266) at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:220) [...]
Is possible to update manually my local .m2 repository with "org.apache.maven.plugins" and "org.codehaus.mojo"?
Thanks in advance
回答1:
The error message just tells that the archetype plugin is not in your local repo.
Of course you can download that plugin and add it to your local repo. Especially with archetype plugin you likely will also need to provide the archetypes you are going to use (and maybe the inventory of archetypes available for the plugin to locate archetypes).
You may also want to consider to run a local repository manager like sonatype nexus or artifactory to ease offline use when you do have access to the internet sometimes and somehow.
I would not target copying the complete set of plugins provided from org.apache.maven and org.codehaus.mojo, but using a repository manager you may experience more ease with providing a decent set of what you "usually" are working with (or expect to work with).
来源:https://stackoverflow.com/questions/36619859/manually-update-maven-m2-with-org-apache-maven-plugins-and-org-codehaus-mojo