Maven:如何复制和复制过滤 EAR 模块中的*测试*资源?
我正在尝试让 Maven 进行过滤&复制两个用于测试的文件。
我尝试将它们放入 src/test/resources 以及 src/test/application 中(如果它有效类似于 src/main/application),但没有任何反应。
文档没有说明任何内容测试资源。
提前致谢!
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals><goal>read-project-properties</goal></goals>
<configuration>
<files>
<file>${filter.build.props}</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<filtering>true</filtering>
<displayName>myapp</displayName>
<version>1.4</version>
<defaultJavaBundleDir>lib</defaultJavaBundleDir>
</configuration>
</plugin>
</plugins>
<filters>
<filter>${filter.build.props}</filter>
</filters>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
I'm trying to get Maven to filter & copy two files used for testing.
I've tried putting them in src/test/resources as well as src/test/application (in case it works similar to src/main/application) but nothing happens.
The documentation doesn't say anything about test resources.
Thanks in advance!
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals><goal>read-project-properties</goal></goals>
<configuration>
<files>
<file>${filter.build.props}</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<filtering>true</filtering>
<displayName>myapp</displayName>
<version>1.4</version>
<defaultJavaBundleDir>lib</defaultJavaBundleDir>
</configuration>
</plugin>
</plugins>
<filters>
<filter>${filter.build.props}</filter>
</filters>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
测试资源未打包在最终包中(无论是 JAR、WAR、EAR)。我不确定您到底想要实现什么,但也许您实际上正在寻找基于过滤和配置文件的解决方案(以选择所需的过滤器)。
Test resources aren't packaged in the final package (be it JAR, WAR, EAR). I'm not sure what you want to achieve exactly but maybe you're actually looking for a solution based on filtering and profiles (to pick up the wanted filter).