1. 程式人生 > >Eclipse使用Maven建立Web時錯誤:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webap

Eclipse使用Maven建立Web時錯誤:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webap

     如圖:

接下來在使用剛新增的catalog建立web工程

      

    這個時候就可以看到Eclipse聯網下載了:

     
這個時候看一下是不是建立成功了

如果還是不能建立或者問題沒有解決可以安裝下面的方法:

1.刪除maven已經下載的檔案路徑:.m2\repository\org\apache\maven

刪除之後再試下,這時候如果看到有進度,只需要耐心等待就行了

2.Maven下載jar慢可以使用國內阿里映象

具體配置檔案(settings.xml)如下,放在.m2資料夾下,.m2一般位於使用者目錄下

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
            http://maven.apache.org/xsd/settings-1.0.0.xsd">
	
	<!-- 這個是配置阿里Maven映象 -->
	<mirrors>
		<mirror>
		  <id>aliyun</id>
		  <name>aliyun</name>
		  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
		  <mirrorOf>central</mirrorOf>
		</mirror>
	</mirrors>
	
	<profiles>
		<profile>
			<id>nexus</id>
			<repositories>
				<repository>
					<id>central</id>
					<url>http://repo.maven.apache.org/maven2</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
				<repository>
					<id>ansj-repo</id>
					<name>ansj Repository</name>
					<url>http://maven.nlpcn.org/</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
			</repositories>
		</profile>
	</profiles>

	<activeProfiles>
		<activeProfile>nexus</activeProfile>
	</activeProfiles>
</settings>