0

在我的 Eclipse 工作区中,在 java 编辑器中保存文件会使 m2e 在项目上运行 defaultGoal(安装),这涉及重写 MANIFEST.MF 文件。因为我正在使用另一个没有 m2e 连接器的插件(maven-scr-plugin),这使得我的清单文件无用。

我想做的是防止 maven-bundle-plugin 在保存时执行,到目前为止我已经提出了两种可能的解决方案:

您可以编辑 Eclipse 生命周期映射,但由于某种原因,这不会起到作用(我认为应该这样做):

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <versionRange>[0.0,)</versionRange>
                <goals>
                    <goal>instructions</goal>
                    <goal>bundle</goal>
                    <goal>manifest</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>

或者,将defaultGoal我的 pom.xml 中的更改为类似的<build>东西compile也意味着不会到达捆绑插件启动的地步,但由于 eclipse 的特性,我真的很讨厌更改我的 pom。

有没有办法为 m2e 插件定义一个 defaultGoal?你们有没有其他的方法来解决这个问题?谢谢!

4

2 回答 2

0

到目前为止,我找到的唯一解决方案(但实际上有效)是<defaultGoal>compile我的父 pom.xml 中设置。它解决了这个问题,但正如问题中所说,它远非最佳,因为它将eclipse东西传播到一个独立于IDE的构建中。

于 2013-05-29T10:11:37.523 回答
0

您可以使用自己的清单文件,如http://maven.apache.org/shared/maven-archiver/examples/manifestFile.html中所述

于 2013-05-29T09:12:38.030 回答