Score:0

Ubuntu 18.04 mvn archetype:generate does not work with error "No plugin found for prefix 'archetype' in the current project and in the plugin groups"

us flag

everyone, I want to use the maven in my Linux Ubuntu system. It has been installed well with the mvn --version as following:

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /opt/apache-maven
Java version: 1.8.0_312, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-100-generic", arch: "amd64", family: "unix"

Then I follow the guide of official website's maven-in-5-minutes to execute this commend mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false but get this errors:

[INFO] ---------------------------------------------
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------
[INFO] Total time:  6.694 s
[INFO] Finished at: 2022-02-22T17:00:24+08:00
[INFO] ---------------------------------------------
[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 (/home/rockyzhang/.m2/repository), jboss-public-repository-group (http://repository.jboss.org/nexus/content/groups/public)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

I also searched it from google. At first, I was wonder it's about the mirror configuration issue of settings.xml under/opt/apache-maven/conf. Then I added some mirrors and repositories info in it as following but the above error still appeared.

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
    <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>
     <mirror>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <url>http://repo1.maven.org/maven2</url>
      <mirrorOf>central-repo1</mirrorOf>
     </mirror>
     <mirror>
         <id>jboss-public-repository-group</id>
         <mirrorOf>central</mirrorOf>
         <name>JBoss Public Repository Group</name>
         <url>http://repository.jboss.org/nexus/content/groups/public</url>
     </mirror>
 </mirrors>  

I also try mvn help:active-profiles to check but get the similar error

[ERROR] No plugin found for prefix 'help' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/rockyzhang/.m2/repository), jboss-public-repository-group (http://repository.jboss.org/nexus/content/groups/public)] -> [Help 1]

I am a new guy and hope someone could give me some hint that whether it is related to the settings.xml configuration issue. If not how to solve it ? The mvn is just installed and there are logging settings.xml toolchains.xml under the /conf

David avatar
cn flag
What version of Ubuntu?
user3841939 avatar
us flag
The Ubuntu version is 18.04 LTS
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.