IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3

问题截图

IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3_第1张图片

原因:

maven的类库出现了问题

解决方法:

修改 G:\apache-maven-3.5.0\conf下的setting.xml
添加

 <localRepository>D:\maven\repositorylocalRepository>

如图
IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3_第2张图片

控制台输入:

mvn help:system
然后查看自己配置的目录是否有respository文件夹,有就说明已经可以使用
接下来再IDEA里面配置这里为自己的maven文件路径
IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3_第3张图片
再次创建web项目时,在网上说可以在多添加一个参数archetypeCatalog=internal,不加这个参数,在maven生成骨架的时候将会非常慢,有时候会直接卡住。(但是我没有添加没有问题)
来自网上的解释:
archetypeCatalog表示插件使用的archetype元数据,不加这个参数时默认为remote,local,即中央仓库archetype元数据,由于中央仓库的archetype太多了,所以导致很慢,指定internal来表示仅使用内部元数据。
IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3_第4张图片

然后
IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3_第5张图片

SUCCESS了,(●’◡’●)

接下来你会发现src/main并没有java目录

一种方法直接建一个目录
IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3_第6张图片
第二种 先创建目录 然后双击resourses,进入项目结构目录,如图操作
IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3_第7张图片

你可能感兴趣的:(web,Java)