0
我是maven和eclipse配置的新手。我建立了我的Maven的路徑在日食集成eclipse和maven時出現錯誤
然後我做了一個項目運行配置在Eclipse
這裏是我的pom.xml的片段
<modelVersion>4.0.0</modelVersion>
<groupId>package</groupId>
<artifactId>myProject</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>myProject</name>
<url>http://maven.apache.org</url>
現在,當我調試我的項目我得到一個錯誤,
Some problems were encountered while building the effective model for
package:war:1.0-SNAPSHOT [WARNING]
'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 189, column 15
在我的pom.xml文件中我有這樣
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
而且我得到錯誤
Failed to execute goal on project myProject: Could not resolve dependencies for
project pk.training.basitMahmood:myProject:war:1.0-SNAPSHOT: Failed to
collect dependencies for [junit:junit:jar:4.4 (test),
org.mockito:mockito-all:jar:1.8.1 (test),
javax.servlet:servlet-api:jar:2.5 (compile),
commons-lang:commons-lang:jar:2.5 (compile),
org.apache.ant:ant-apache-log4j:jar:1.8.0 (compile),
velocity-tools:velocity-tools:jar:1.4 (compile),
org.springframework:spring-core:jar:2.5.5 (compile),
org.springframework:spring-webmvc:jar:2.5.5 (compile),
org.springframework:spring:jar:2.5.5 (compile),
org.springframework:spring-test:jar:2.5.5 (compile),
org.springframework.ws:spring-oxm:jar:1.5.5 (compile),
org.springframework.ws:spring-oxm-tiger:jar:1.5.6 (compile),
org.springframework.ws:spring-ws-core:jar:1.5.6 (compile),
org.springframework.ws:spring-ws-core-tiger:jar:1.5.6 (compile),
org.springframework.ws:spring-ws-security:jar:1.5.6 (compile),
org.apache.velocity:velocity:jar:1.6.3 (compile),
commons-digester:commons-digester:jar:1.8 (compile),
ant:ant-jakarta-regexp:jar:1.6.1 (compile),
org.json:json:jar:20090211 (compile),
com.xmlparserv2:LS360_xml_parser:jar:20110919 (compile),
360_Oracle:toplink:jar:10.1.5 (compile),
360_MS_SQL:sqlserver:jar:1.0 (compile),
org.springframework.ws:spring-ws:jar:all:1.5.6 (compile)]:
Failed to read artifact descriptor for velocity-tools:velocity-tools:jar:1.4:
Could not transfer artifact velocity-tools:velocity-tools:pom:1.4 from/to
maven2-repository.jboss.com (http://repository.jboss.com/maven2):
Access denied to
http://repository.jboss.com/maven2/velocity-tools/velocity-tools/1.4/
velocity-tools-1.4.pom. Error code 403, Forbidden -> [Help 1]
但是我有所有這些dependicies在我的POM的項.xml,就像
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
.....
</dependencies>
這裏是倉庫
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>maven-repository.dev.java.net</id>
<url>http://download.java.net/maven/1</url>
</repository>
<repository>
<id>maven2-repository.jboss.com</id>
<url>http://repository.jboss.com/maven2</url>
</repository>
<repository>
<id>maven2-apache</id>
<url>http://ftp.cica.es/mirrors/maven2/</url>
</repository>
</repositories>
爲什麼我收到這些錯誤?我如何解決它?
感謝
嗨,謝謝,實際上所有這些存儲庫都是由某人定義的,我需要糾正這些代碼。任何如何,添加版本'org.apache.maven.plugins:maven-compiler-plugin缺失。 @行189,列15'這個錯誤已被刪除,但我仍然得到jar依賴關係錯誤'無法執行目標項目myProject:....'。雖然所有依賴關係都是在pom.xml中定義的。你能告訴我爲什麼我仍然得到錯誤嗎?謝謝 – Basit 2013-05-07 07:27:40
實際上,當我去命令行並在我的項目的根目錄下運行命令'mvn clean install'時,其中存在pom.xml,那麼它工作正常,它會生成war文件。這就是爲什麼我要在eclipse中這樣做,所以每次我都沒有去執行這個命令的命令行。 – Basit 2013-05-07 07:29:30
錯誤消失了,在進行構建配置時,我更改了Maven運行時,我可以編輯您的答案以放置該圖片嗎? – Basit 2013-05-07 09:54:41