Article From:https://segmentfault.com/q/1010000011707172
Question:

mavenCreating projects through catalog is always a failure.http://ip:port/nexus/content/repositories/releases/The archetypeCatalog under “http://ip:port/nexus/content/repositories/releases/” is not supported anymore.

How can I create projects according to catalog files in my personal clothes?

Answer 0:

cnblogsSimilar problems on

https://www.cnblogs.com/Frank…

Use the followingCommand XSolve the problem:

mvn archetype:generate -DarchetypeGroupId=com.my.company.archetype -DartifactId=system-parent -DarchetypeArtifactId=systemplate-parent-archetype  -DarchetypeRepository=http://ip:port/nexus/content/repositories/releases -DarchetypeCatalog=remote -DarchetypeVersion=0.0.1

Command explanation

Above, the corresponding URL is specified under the -DarchetypeRepository.archetype-catalog.xmlFile, which defines all project architecture template definitions that can be created through the catalog file, as shown below

<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd"
    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <archetypes>
    <archetype>
      <groupId>com.my.company.archetype</groupId>
      <artifactId>systemplate-parent-archetype</artifactId>
      <version>0.0.1</version>
      <repository>http://ip:port/nexus/content/repositories/releases</repository>
    </archetype>
  </archetypes>
</archetype-catalog>

Command XIn the middle,-DarchetypeGroupIdAnd catalog filearchetypes.archetype.groupIdThe same;-DarchetypeArtifactIdandarchetypes.archetype.artifactIdThe same;-DarchetypeVersionandarchetypes.archetype.versionThe same;-DarchetypeRepositoryAnd problemshttp://ip:port/nexus/content/repositories/releases/The same.

implementCommand X

Interactive input groupId and package can be.

Alternatively, specify groupId and package in the command. Then add parameters.-DinteractiveMode=false,They will execute silently.

Simplified command

mvn archetype:generate -DarchetypeRepository=http://ip:port/nexus/content/repositories/releases -DarchetypeCatalog=remote

Interactive selection through the above commandsarchetype-catalog.xmlThe archetype in the file is OK.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *