2014-05-09 37 views
0

的POM文件安裝所有我的pom.xml如下所示:的Maven不會導致「缺少所需的庫」×124

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<parent> 
    <groupId>be.ugent.sop.p404</groupId> 
    <artifactId>P404</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
</parent> 
<artifactId>P404EJB</artifactId> 
<name>P404EJB</name> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-ejb-plugin</artifactId> 
      <configuration> 
      <ejbVersion>3.1</ejbVersion> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

<dependencies> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-java</artifactId> 
     <version>2.40.0</version> 
    </dependency> 

    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
     <version>5.1.29</version> 
    </dependency> 
    <dependency> 
     <groupId>org.eclipse.persistence</groupId> 
     <artifactId>org.eclipse.persistence.jpa</artifactId> 
     <version>2.5.2-M1</version> 
    </dependency> 
    <dependency> 
     <groupId>javax</groupId> 
     <artifactId>javaee-api</artifactId> 
     <version>7.0</version> 
     <scope>provided</scope> 
    </dependency> 


    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
    </dependency> 
    <dependency> 
     <groupId>org.databene</groupId> 
     <artifactId>contiperf</artifactId> 
     <version>2.2.0</version> 
    </dependency> 

    <dependency> 

     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>1.2.17</version> 
    </dependency> 

    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
     <version>1.7.6</version> 
    </dependency> 

    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-log4j12</artifactId> 
     <version>1.7.6</version> 
    </dependency> 



    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
    </dependency> 

    <dependency> 
     <groupId>org.databene</groupId> 
     <artifactId>contiperf</artifactId> 
     <version>2.2.0</version> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.geronimo.specs</groupId> 
     <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId> 
     <version>1.1</version> 
    </dependency> 

    <dependency> 
     <groupId>com.googlecode.json-simple</groupId> 
     <artifactId>json-simple</artifactId> 
     <version>1.1.1</version> 
    </dependency> 

    <dependency> 
     <groupId>commons-codec</groupId> 
     <artifactId>commons-codec</artifactId> 
     <version>1.4</version> 
    </dependency> 

</dependencies> 

<packaging>ejb</packaging> 

由於這些問題的一個例子我我收到:

Description Resource Path Location Type 
Project 'P404EJB' is missing required library: '/home/zeesteen/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar' P404EJB  Build path Build Path Problem 

我以爲,使用下面的命令後:

mvn clean install eclipse:eclipse 

Maven應該抓取那些在我的機器上沒有的圖書館嗎? (該文件夾,例如「COM」不要在.m2目錄/存儲庫文件夾存在)

我曾嘗試多種解決方案,自己如 - 再取出Maven的性質,乾淨安裝,轉換爲Maven項目 - 這樣做在乾淨的命令 變化 - 右鍵單擊​​該項目,做的Maven>更新項目 - 通過月食

我喜歡124個上面提到的一個Java構建路徑問題清潔項目。

+0

這是在服務器上運行嗎? – PKlumpp

+0

這是在本地運行。這個錯誤來自eclipse – Spyral

+0

,你應該確保你停止所有正在運行的程序實例並重新運行它。如果這沒有幫助,我不知道 – PKlumpp

回答

0

請確保您已在Java Build Path中的Libraries下添加Maven Dependencies

注意:您可以通過右鍵單擊該項目並單擊屬性來檢查屬性。如果不添加,您可以點擊Add Library並選擇Maven Managed dependencies並完成

+0

http:// i。 imgur.com/Oamhhau.png所有缺少的庫都存在,但它們不在.m2的文件夾結構中,因此其中一些文件夾上有紅色十字圖標。任何方式強制maven下載這些? – Spyral

+0

好的,請在運行'mvn clean install'時發佈錯誤信息? – Keerthivasan

+0

修復它..看看我自己的解決方案的答案。儘管感謝您的幫助! – Spyral

1

我發現這個錯誤..

Maven的,因爲沒有什麼錯我的Maven的回購顯然沒有給出錯誤。 Eclipse已將我的settings.xml maven文件的位置更改爲「不存在」位置。導致所有問題。我手動將其改回,所有問題都解決了。

在Eclipse中我所做的: 窗口>首選項>的Maven>用戶設置:字段用戶設置錯了 (日食改變了它..)把它放回去的地方,我第一次進行的設置,應用,清潔工程和一切被修好了!