我想使用maven-resources-plugin将资源复制到另一个目录.
我的资源目录具有以下结构:
log4j.xml
xml
|_ resource-1
|_ resource-n
Run Code Online (Sandbox Code Playgroud)
我想只将log4.xml复制到输出目录.这是我的插件代码:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>${glassfish.conf}</outputDirectory>
<resources>
<resource>
<directory>${conf.location}</directory>
<includes>
<include>**/log4j.xml</include>
</includes>
<excludes>
<exclude>**/xml/*</exclude>
</excludes>
</resource>
</resources>
</configuration>
<executions>
<execution>
<id>copy-log4j-to-glassfish</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是所有都被复制到输出目录(log4j.xml和xml目录).
我试过了
<resource>
<directory>${conf.location}</directory>
<excludes>
<exclude>**/xml/*</exclude>
</excludes>
</resource>
Run Code Online (Sandbox Code Playgroud)
要么
<resource>
<directory>${conf.location}</directory>
<includes>
<include>**/log4j.xml</include>
</includes>
</resource>
Run Code Online (Sandbox Code Playgroud)
甚至
<resource>
<directory>${conf.location}</directory>
<excludes>
<exclude>**/*</exclude>
</excludes>
</resource>
Run Code Online (Sandbox Code Playgroud)
但目录的所有内容都包含在内......问题是什么?
谢谢
回答Andrew Logvinov:
使用这样的插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-log4j-to-glassfish</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${glassfish.conf}</outputDirectory>
<resources>
<resource>
<directory>${conf.location}</directory>
<includes>
<include>log4j.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
它工作得很好,只复制了log4j.xml.
现在有了这个插件配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-log4j-to-glassfish</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${glassfish.conf}</outputDirectory>
<resources>
<resource>
<directory>${conf.location}</directory>
<includes>
<include>log4j.xml</include>
</includes>
</resource>
</resources>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的所有文件都被复制了.
我检查xsd 这里是configuration块可以在里面plugin或里面execution标签所以我不知道这是一个插件bug还是这个误解了我.
| 归档时间: |
|
| 查看次数: |
21081 次 |
| 最近记录: |