且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven远程资源插件问题

更新时间:2022-10-31 16:07:09

我最终找到了解决方案.问题实际上是我必须在pom配置中明确指定include,以正确生成remote-resources.xml,并在稍后的处理目标中选择要获取remote-resource.xml中列出的所有资源.

I managed to find a solution in the end. The problem was in fact that I had to explicitly specify includes in the pom configuration to have remote-resources.xml generated properly and later in the process goal to pick up all the resource listed in the remote-resource.xml.

因此,共享资源模块的最终pom应该如下所示(如果您想包含所有内容):

So, the final pom for shared-resources module should look like this (if you want to include everything):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.myorganization</groupId>
        <artifactId>myapp</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>myapp-resources</artifactId>
    <name>Resources Bundle</name>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>**/*.*</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>      
    </build>
</project>

附加说明 看来process目标的outputDirectory没有任何效果,资源已在插件中指定的默认路径上解包.

Additional note It seems that outputDirectory for process goal has no effects, resources are unpackaged on the default path specified in the plugin.