Eclipse 不能build, pom文件上面有叉叉 解决办法

Error message:  

  1. 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.....

  1. 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) .  
  2.   
  3. m2e-wtp provides a set of m2e connectors used for the configuration of Java EE projects in WTP. It features :  
  4.   
  5. •Support for war projects : adds the Java and Dynamic Web Facets. Support war overlays and on-the-fly resource filtering  
  6. •Support for ejb projects : adds the Java and EJB Facets.  
  7. •Support for ear projects : adds the EAR Facet. Supports application.xml and jboss.xml file generation, resource filtering  
  8. •Support for rar projects : adds the Java and Connector Facets.  
  9. •Support for app-client projects : adds the Java and Application Client Facets. Supports deployment descriptor filtering.  
  10. •Support for web-fragment projects : adds the Java and Web Fragment Facets if a web-fragment.xml file is detected in the resource folders.  
  11. •Support for jar dependency projects : adds the Java and Utility Facets.  
  12. 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 :  
  13. Window > Preferences > Install / Update > Available Software Sites  
  14. Since 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.

  1. <!--My pom.xml segment-->  
  2. ...................  
  3. <plugin>  
  4.                 <groupId>org.apache.maven.plugins</groupId>  
  5.                 <artifactId>maven-dependency-plugin</artifactId>  
  6.                 <executions>  
  7.                     <execution>  
  8.                         <id>copy-mar-dependencies</id>  
  9.                         <phase>process-resources</phase>  
  10.                         <goals>  
  11.                             <goal>copy-dependencies</goal>  
  12.                         </goals>  
  13.                         <configuration>  
  14.                             <includeTypes>mar</includeTypes>  
  15.                             <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/modules</outputDirectory>  
  16.                         </configuration>  
  17.                     </execution>  
  18.                     <execution>  
  19.                         <id>copy-aar-dependencies</id>  
  20.                         <phase>process-resources</phase>  
  21.                         <goals>  
  22.                             <goal>copy-dependencies</goal>  
  23.                         </goals>  
  24.                         <configuration>  
  25.                             <includeTypes>aar</includeTypes>  
  26.                             <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/services</outputDirectory>  
  27.                         </configuration>  
  28.                     </execution>  
  29.                 </executions>  
  30.             </plugin>  
  31. ......................  

问题解决:

原因:  我用的两个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: oolsMVN+DEeclipseeclipse.exe  -vm "C:Program FilesJavajdk1.6.0_30injavaw.exe". 问题解决.

转:http://blog.csdn.net/lhooouuu/article/details/6933569

原文地址:https://www.cnblogs.com/shortboy/p/3183769.html