在Maven中创建web项目时报错Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from an
无法从任何已经配置的库里面解析 org.apache.maven.archetypes:maven-archetype-webapp:1.0。
是因为缺少webapp 这个包
第二段第一句话:从https://repo.maven.apache.org/maven2下载org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0失败。
所以问题是org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0这个包在创建maven web项目时maven找不到,或者是找到了但没有办法解析。
当找不到或者无法解析时,如果没有为maven配置远程仓库,就无法从远程仓库下载下来。
解决办法
1.先在CMD中输入mvn help:system命令行,执行后会自动下载所需东西。
2.下载结束后,输入命令:mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false?
全部下载完成后项目就可以创建了
此时会下载所需要的项目jar包,等待下载完毕就可以创建项目了。