开发者

How to copy resources from other module to specific location ? (maven)

开发者 https://www.devze.com 2023-01-02 12:44 出处:网络
I have a maven-managed project with some modules. One module contains some native codes inside \"src/main/resources/native\" directory.

I have a maven-managed project with some modules. One module contains some native codes inside "src/main/resources/native" directory. Second module packages all related modules to a WAR file.

Here comes the question : How to copy the "native/" directory (and its sub-directories) in first module to WEB-INF/native directory in the second module ?

I found a copy res开发者_如何转开发ources plugin , but it seems not what I want. (It copies directory inside the same module , but I want cross-module copy)


This is doable with dependency:unpack (that I would bind on the prepare-package phase) and the appropriate excludes/includes . See the Unpacking specific artifacts example.


The goal of modules in maven is to spearate them from each other. I am afraid there will be no satisfactory solution inside maven as this goes against the grain.

A solution could be to create a war archive with your resources and depend on that to build your final war.

I use for a project for example the camel-web resources by adding a dependency :

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-web</artifactId>
        <version>${camel.version}</version>
        <type>war</type>
        <scope>runtime</scope>
    </dependency>

The war resources are merged with my web resources.

0

精彩评论

暂无评论...
验证码 换一张
取 消