首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将.properties文件与Apache shades插件合并

将.properties文件与Apache shades插件合并
EN

Stack Overflow用户
提问于 2015-05-20 17:58:08
回答 1查看 1.1K关注 0票数 0

我正在尝试使用shades插件将出现在两个依赖项(openwebbeans-impl,openejb- openwebbeans.properties )中的核心文件合并到我的一个OSGi包中。我按照shades文档进行配置,如下所示https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer

代码语言:javascript
复制
   <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全新安装时,它失败了,错误如下

代码语言:javascript
复制
[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上下文。但是我仍然想知道合并属性文件的正确方式是什么。或者如何解决这个问题。

EN

回答 1

Stack Overflow用户

发布于 2015-05-22 23:56:54

棘手的部分是我们在每个文件中都有一个'configuration.ordinal‘属性。这定义了信息被“合并”的顺序。较高的序数值稍后将应用于较低的序数配置。因此,来自较高序号配置的配置设置将保持不变。

有关更多信息,请访问https://struberg.wordpress.com/2010/09/21/flexible-configuration-for-modular-systems/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30346343

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档