现在maven越来越流行,许多人开始选择这个行业,但是在创建maven项目时总是出现各种各样的问题,发现不能创建maven项目,那么这个时候该怎么办呢?下面小编就和大家来聊一聊为什么不能创建maven项目,创建maven项目失败了怎么办?
如果在eclipse新建maven-archetype-webapp项目时报错:
Could not resolve archetype org.apache.maven.archetypes: maven - archetype - webapp: 1.0 from any of the configured repositories Could not resolve archetype org.apache.maven.archetypes: maven - archetype - webapp: 1.0 from any of the configured repositories. Could not resolve artifact org.apache.maven.archetypes: maven - archetype - webapp: pom: 1.0 Failure to transfer org.apache.maven.archetypes: maven - archetype - webapp: pom: 1.0 from http: //maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of maven-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to maven-aliyun (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com Failure to transfer org.apache.maven.archetypes: maven - archetype - webapp: pom: 1.0 from http: //maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of maven-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to maven-aliyun (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com
出现这种问题的主要原因就是在仓库中找不到maven-archetype-webapp-1.0.jar,最好配置阿里巴巴的仓库。
在Eclipse Maven配置中添加新的Catalog配置,也可以下载到本地,然后再添加,这样比较快,eclipse联网比较慢
接下来在使用刚添加的catalog创建web工程
这个时候就可以看到Eclipse联网下载了:
1这个时候看一下是不是创建成功了
如果还是不能创建或者问题没有解决可以安装下面的方法:
删除maven已经下载的文件路径:.m2 epositoryorgapachemaven
删除之后再试下,这时候如果看到有进度,只需要耐心等待就行了 ,手动下载、用命令行安装。
eclipse 配置Maven问题解决办法:新建maven工程时报错:Could not resolve archetype org.apache.maven.archetypes .
首先maven.archetypes下载地址:
在新建maven工程时报错:
Could not resolve archetype org.apache.maven.archetypes: maven - archetype - quickstart: RELEASE from any of the configured repositories. Could not resolve artifact Missing org.apache.maven.archetypes: maven - archetype - quickstart: pom: RELEASE
解决思路:在本地库中装载maven-archetype-quickstart
从http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/ 下载最新版maven-archetype-quickstart-1.1.jarcmd窗口执行mvn install:install-file -DgroupId=org.apache.maven.archetypes -DartifactId=maven-archetype-quickstart -Dversion=1.1 -Dpackaging=jar -Dfile=maven-archetype-quickstart-1.1.jar
再创建maven工程,成功。
在新建maven 项目后,发现报此错误
Failure to transfer org.apache.maven.plugins: maven - resources - plugin: pom: 2.6 from https: //repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.Original error: Could not transfer artifact org.apache.maven.plugins: maven - resources - plugin: pom: 2.6 from / to central(https: //repo.maven.apache.org/maven2): The operation was cancelled.
02解决方法也就很简单了,打开Window下面 的 preferences
03找到maven 选项,选中里面的user setting (就是你maven 的配置),复制Local Repository 的地址。
04在桌面打开运行, 输入复制的地址。 删除 整个repository 目录,然后重启Eclipse。 如果已有maven 项目会自动 帮你配置,没有的话新建一个maven 项目 也会帮你自动配置。
以上就是今天Java常见问答的相关内容,更多相关内容请持续关注本网站吧。