java - Eclipse 中的 exec-maven-plugin :1. 2.1

标签 java eclipse maven eclipse-plugin

将 Maven 项目导入 Eclipse 时出现以下错误:

No marketplace entries exec-maven-plugin:1.2.1 error

而且它看起来会导致导入后进一步的构建问题 - 就像

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:exec-maven-plugin:1.2.1:java (execution: default, phase: generate-sources)

是我缺少插件还是我的 pom.xml 有问题?

已安装的 m2e:

m2e - Maven Integration for Eclipse (includes Incubating components) 1.5.0.20131218-1208 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e

Eclipse Java Development Tools 3.8.2.v20130116-090414-8-8nFu3FNOfwKLRuqgXKIy9z0I83 org.eclipse.jdt.feature.group Eclipse.org

Eclipse Platform 4.2.1.v20130118-173121-9MF7GHYdG0B5kx4E_SkfZV-1mNjVATf67ZAb7 org.eclipse.platform.feature.group Eclipse.org

Eclipse RCP 4.2.2.v20130129-152330-7IARAABrMQkGSvMgQnUlz-DQz00h org.eclipse.rcp.feature.group Eclipse.org

提前致谢。

最佳答案

问题是 Eclipse 的 m2e 插件不知道 exec-maven-plugin 你可以通过以下方式解决:

   <build>
      <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>exec-maven-plugin</artifactId>
                                        <versionRange>[1.2.1,)</versionRange>
                                        <goals>
                                            <goal>java</goal>
                                            <goal>exec</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore/>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
   </build>

关于java - Eclipse 中的 exec-maven-plugin :1. 2.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21721846/

相关文章:

java - 在 javadoc 中使用源路径

java - ConcurrentHashMap.putIfAbsent 的性能

java - 是否可以在已经存在的对象中模拟单个方法?

Java在Eclipse中自动生成: generating .类文件

java - 为什么 Drive.Builder 无法解析为类型?

eclipse - 通过Eclipse在Windows上设置Docker Toolbox

java - 为什么 <value>!0</value> 匹配默认值 0?

带有 GSON 的 Java 堆空间

eclipse - 使用maven-clean程序包,xml源文件不包括在classpath中

java - 如何配置tomcat每次都重新部署war?