Thursday, May 19, 2016

mvn archetype:generate does not work-no plugin found

When run the below:
mvn archetype:generate
got the below error:

mvn archetype:generate does not work-no plugin found for prefix 'archetype'

add -X and search metadata.xml:
mvn -X archetype:generate
It cannot get the *metadata.xml from the central repository because of the firewall/certification
although from the web browser the link is accessible:
Two solutions:
1. add settings.xml in the mvn .m2 folder:
<settings>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>securecentral</activeProfile>
  </activeProfiles>
  <profiles>
    <profile>
      <id>securecentral</id>
      <!--Override the repository (and pluginRepository) "central" from the
         Maven Super POM -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://repo1.maven.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://repo1.maven.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</settings>
2. get and set the certificate file
See:
http://stackoverflow.com/questions/25911623/problems-using-maven-and-ssl-behind-proxy

No comments:

Post a Comment