问题
使用Maven命令创建工程:
mvn archetype:create -DgroupId=org.seckill -DartifactId=seckill -DarchetypeArtifactId=maven-archetype-webapp
错误提示
The goal you specified requires a project to execute but there is no POM in this directory (E:\Pro\Java_Pro\WorkSpaceForJob). Please verify you invoked Maven from the correct directory.
解决
1)从Stack Overflow上看到的解决方式是将每个参数加上符号“”:
mvn archetype:create "-DgroupId=org.seckill" "-DartifactId=seckill" "-DarchetypeArtifactId=maven-archetype-webapp"
执行,又提示如下错误:
Could not find goal 'create' in plugin org.apache.maven.plugins:maven-archetype-plugin:3.0.1 among available goals crawl, create-from-project, generate, help, integration-test, jar, update-local-catalog
2)maven3.5以上版本丢弃掉create方式创建maven,使用generate:
mvn archetype:generate -DgroupId=org.seckill -DartifactId=seckill -DarchetypeArtifactId=maven-archetype-webapp
正确执行,遇到交互直接回车即可。