Eclipse 不能build, pom檔案上面有叉叉 解決辦法

來源:互聯網
上載者:User

Error message:  

execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (execution: default-jar, phase: process-classes)

多個子項目的pom.xml檔案在eclipse下都有叉叉, 上面是error msg. 查閱網上資料, eclipse 讀取pom.xml, 執行pom中的外掛程式. 而m2e外掛程式對pom中外掛程式的不全部支援, eclipse就會提示pom.xml檔案有錯.

解決辦法: 下載安裝m2e-wtp外掛程式, 可以在eclipse market中找到. 會解決大部分eclipse讀取pom.xml的錯誤.

下面看看m2e-wtp外掛程式的描述: 大概是加強eclipse中maven的支援, 依賴war/ejp/ear/rar.....

Maven Integration for Eclipse WTP (a.k.a m2e-wtp) aims at providing a tight integration between Maven Integration for Eclipse (a.k.a m2e) and the Eclipse Web Tools Project (WTP) .m2e-wtp provides a set of m2e connectors used for the configuration of Java EE projects in WTP. It features :•Support for war projects : adds the Java and Dynamic Web Facets. Support war overlays and on-the-fly resource filtering•Support for ejb projects : adds the Java and EJB Facets.•Support for ear projects : adds the EAR Facet. Supports application.xml and jboss.xml file generation, resource filtering•Support for rar projects : adds the Java and Connector Facets.•Support for app-client projects : adds the Java and Application Client Facets. Supports deployment descriptor filtering.•Support for web-fragment projects : adds the Java and Web Fragment Facets if a web-fragment.xml file is detected in the resource folders.•Support for jar dependency projects : adds the Java and Utility Facets.Note that m2e-wtp requires m2e-wtp 1.0. You must make sure m2e's update site (http://download.eclipse.org/technology/m2e/releases/) is defined in :Window > Preferences > Install / Update > Available Software SitesSince m2e 1.0 is incompatible with previous versions, you may have to uninstall old m2e and m2e-wtp versions before proceeding with the installation.

再看看eclipse:

項目可以build了, delete後重新import, pom.xml和項目的叉叉都沒了. 在開啟pom.xml, 開啟dependency hierarchy, 發現現在可以查看依賴關係了.

 

遺留問題1:

1. maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.

<!--My pom.xml segment-->...................<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><executions><execution><id>copy-mar-dependencies</id><phase>process-resources</phase><goals><goal>copy-dependencies</goal></goals><configuration><includeTypes>mar</includeTypes><outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/modules</outputDirectory></configuration></execution><execution><id>copy-aar-dependencies</id><phase>process-resources</phase><goals><goal>copy-dependencies</goal></goals><configuration><includeTypes>aar</includeTypes><outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/services</outputDirectory></configuration></execution></executions></plugin>......................

問題解決:

原因:  我用的兩個eclipse,這個是由於用了M2E外掛程式造成的,而在m2eclipse下就沒有這個問題。當然,你可以用其他的打包外掛程式,這個不是必須要用這個,所以,只是自己知道原因和解決就可以了。不一定是要換環境解決,你可以換一個plugin也可以。http://blog.csdn.net/sebatinsky/article/details/6273977

安裝成功後, 有時項目會顯示驚嘆號, 只要 update dependency, 驚嘆號變成叉叉,  再重新build就OK了. 項目就可以用eclipse編譯, 替換jboss中class檔案就可以了.

 

問題2: maven 提示找不到jdk.  沒影響自己使用eclipse 中的maven.

warn info 貼上去, 答案遍地是. 我想說的是: 都試過, 不管用, 建立捷徑,

添加: D:\tools\MVN+DE\eclipse\eclipse.exe  -vm "C:\Program Files\Java\jdk1.6.0_30\bin\javaw.exe". 問題解決.
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.