我试图在使用时覆盖默认资源目录(src/main/resources)maven-远程-资源-插件。然而,下面示例中的指定值似乎没有被考虑在内。如果有人能给我一些指示,我将不胜感激。
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.resource.library</groupId>
<artifactId>resource-library</artifactId>
<version>1.0</version>
<name>ResourceLibrary</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>
<resourcesDirectory>${basedir}/common</resourcesDirectory>
<includes>
<include>**/*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
编辑:我想知道这是否是插件中的错误,因为我在构建的 DEBUG 输出中看到以下内容,这意味着它尝试使用正确的资源目录。调试输出中没有出现任何其他相关内容。
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-remote-resources-plugin:1.5:bundle' with basic configurator -->
[DEBUG] (f) includes = [**/*]
[DEBUG] (f) outputDirectory = C:\jit\workspace\ResourceLibrary\target\classes
[DEBUG] (f) resourcesDirectory = C:\jit\workspace\ResourceLibrary\common
编辑:我认为这实际上可能是一个错误,所以提出了:MR资源-96
为什么需要 maven-remote-resources-plugin?
如果您的目标是override the default resources directory
,然后你可以使用Maven 资源:复制资源,因为它更灵活。一个例子here.
选择
您还可以使用resources
资源插件提供的目标,并在pom文件的块中指定资源。例子here.
Edit
关于maven-remote-resources-plugin,请参见usage page:
这将触发对该项目的 $basedir/src/main/resources 目录的扫描并创建 $basedir/target/classes/META-INF/maven/remote-resources.xml 清单文件。
这意味着这个插件将创建remote-resources.xml
文件,但这并不意味着它会为您复制资源。
我使用您的插件配置创建了一个空的 Maven 项目,它实际上创建了一个remote-resources.xml 文件。另外,它没有复制 ${basedir}/common 下的文件
为此,只需在构建部分指定资源即可。例子:
<build>
<resources>
<resource>
<directory>${basedir}/common</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<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>
<resourcesDirectory>${basedir}/common</resourcesDirectory>
<includes>
<include>**/*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)