(我和Maven一起工作了很多年。我有点不敢相信我现在才遇到这个问题。)
超级POM定义了它的<resources>节,如下所示:
<resources> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> </resources>我在我的pom.xml有一个<resources>节,如下所示:
<resources> <resource> <directory>${project.basedir}</directory> <includes> <include>LICENSE</include> </includes> <targetPath> </resource> </resource>当我运行mvn help:effective-pom ,我可以看到Maven已经删除了超级POM(有用的) <resources>节,并将其替换为我自己的节。
相反,我想将我的<resources>节的内容添加到超级POM提供的内容中。
没有放在我的<resources>元素上的combine.children或combine.self属性的组合导致这种情况发生(加上我不知道这些名称应该表示什么,尽管我已阅读有关该主题的文章 ) 。
我错过了什么明显的事情?
(I've been working with Maven for many years. I sort of can't believe I've only now encountered this issue.)
The super POM defines its <resources> stanza like this:
<resources> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> </resources>I have a <resources> stanza in my pom.xml like this:
<resources> <resource> <directory>${project.basedir}</directory> <includes> <include>LICENSE</include> </includes> <targetPath> </resource> </resource>When I run mvn help:effective-pom, I can see that Maven has eliminated the super POM's (helpful) <resources> stanza and has replaced it with my own.
Instead, I'd like to add the contents of my <resources> stanza to that supplied by the super POM.
No combination of either of the combine.children or combine.self attributes placed on my <resources> element causes this to happen (plus I have no idea what these names are supposed to indicate, though I've read an article on the subject).
What obvious thing am I missing?
最满意答案
像combine.children和combine.self这样的神奇属性仅适用于插件的配置; pom本身被转换为一组pojos,但插件配置是一个XML-DOM。 使用xpp3功能,我们可以定义合并策略。 是的,AFAIK资源总是被覆盖,永远不会扩展。 资源没有唯一标识符,因此无法检测应合并,覆盖或扩展哪些资源块。
The magic attributes like combine.children and combine.self only apply on the configuration of plugins; the pom itself is transformed to a set of pojos, but the plugin-configuration is a XML-DOM. With xpp3 features we can define a merge strategy. And yes, AFAIK resources are always overwritten, never extended. A resource doesn't have a unique identifier, so it is not possible to detect which resource-blocks should be merged, overridden or extended.
更多推荐
发布评论