使用如下命令-使用项目骨架创建一个maven项目:
mvn archetype:generate \
-DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-quickstart-java \
-DarchetypeCatalog=https://repository.apache.org/content/repositories/snapshots/ \
-DarchetypeVersion=1.3-SNAPSHOT \
-DgroupId=wiki-edits \
-DartifactId=wiki-edits \
-Dversion=0.1 \
-Dpackage=wikiedits \
-DinteractiveMode=false
报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli)
on project standalone-pom: archetypeCatalog 'https://repository.apache.org/content/repositories/snapshots/' is not supported anymore. Please read the plugin documentation for details. -> [Help 1]
[ERROR]
一开始觉得是仓库有问题,但是换了仓库同样报错,最后觉得应该是和maven-archetype-plugin
版本有关:
使用2.4版本执行:
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=https://repository.apache.org/content/repositories/snapshots/
发现可以成功执行。
使用3.0.1版本执行,发现报同样的错:
mvn org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate -DarchetypeCatalog=https://repository.apache.org/content/repositories/snapshots/
于是使用指定插件版本的命令:
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate\
-DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-quickstart-java \
-DarchetypeCatalog=https://repository.apache.org/content/repositories/snapshots/ \
-DarchetypeVersion=1.3-SNAPSHOT \
-DgroupId=wiki-edits \
-DartifactId=wiki-edits \
-Dversion=0.1 \
-Dpackage=wikiedits \
-DinteractiveMode=false
BUILD SUCCESS。