我正在尝试使用shades插件将出现在两个依赖项(openwebbeans-impl,openejb- openwebbeans.properties )中的核心文件合并到我的一个OSGi包中。我按照shades文档进行配置,如下所示https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/openwebbeans/openwebbeans.properties</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>但是当我尝试mvn全新安装时,它失败了,错误如下
[INFO] --- maven-shade-plugin:2.3:shade (default) @ tomee ---
[ERROR] The project main artifact does not exist. This could have the following
[ERROR] reasons:
[ERROR] - You have invoked the goal directly from the command line. This is not
[ERROR] supported. Please add the goal to the default lifecycle via an
[ERROR] <execution> element in your POM and use "mvn package" to have it run.
[ERROR] - You have bound the goal to a lifecycle phase before "package". Please
[ERROR] remove this binding from your POM such that the goal will be run in
[ERROR] the proper phase.
[ERROR] - You removed the configuration of the maven-jar-plugin that produces the main artifact.
[INFO] ------------------------------------------------------------------------有人能告诉我我的配置中有什么错误吗?执行此操作的正确方法是什么?
编辑过的
根据struberg提供的答案,我的尝试似乎不适用于openwebebans上下文。但是我仍然想知道合并属性文件的正确方式是什么。或者如何解决这个问题。
发布于 2015-05-22 23:56:54
棘手的部分是我们在每个文件中都有一个'configuration.ordinal‘属性。这定义了信息被“合并”的顺序。较高的序数值稍后将应用于较低的序数配置。因此,来自较高序号配置的配置设置将保持不变。
有关更多信息,请访问https://struberg.wordpress.com/2010/09/21/flexible-configuration-for-modular-systems/
https://stackoverflow.com/questions/30346343
复制相似问题