Search code examples
mavenmaven-archetype

Custom maven archetype:generate defaults to version 3.1.1 instead of 3.1.2?


I have build a custom maven archetype in my local. However while generating a project it always looks for the maven archetype:generate version 3.1.1 instead of 3.1.2. I have multiple modules in my project with profiles to avoid the bug associated in 3.1.1 using the upgraded version 3.1.2. Here is the error.

 C:\Repo>mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=com.lamo.archtypes -DarchetypeArtifactId=microservice-component-server -DarchetypeVersion=0-SNAPSHOT  -
DgroupId=com.organisation.platform.product -Dpackage=com.organisation.platform.product.pd  -DartifactId=product-server -Dcomponent-short-name=pd -Dcomponent-long-name=product

[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.1.1/maven-archetype-plugin-3.1.1.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.1.0/maven-archetype-plugin-3.1.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.0.1/maven-archetype-plugin-3.0.1.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.0.0/maven-archetype-plugin-3.0.0.pom

Here is the public repository link to my custom archetype https://github.com/lagnajit712/microservice-component-server


Solution

  • If you want a specific version of the maven archetype plugin, just specify it. Use

    mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeCatalog...