我是一个 Maven 新手,我的项目终于可以正确编译和运行了。
在每次运行时,我的项目都会在运行时创建的动态位置 ( ) 上编写报告,username_timestamp
并使用该位置设置一个System.property
调用REPORTS_LOCATION
。执行后,我想使用 maven 目标将一些静态资源(样式、图像、js 等)复制到这个动态文件夹中。
我想不通的是如何让 Maven 知道这个动态位置或访问这个 System.property
我准备让我的项目将这些资源复制到目录中,但我想我会再试一次,以防有一种简单的/Maven 方式来执行此操作。
我已经将资源复制到硬编码位置。这是 POM 的一个片段。我正在使用 Jbehave 的 Maven 目标,它们确实按顺序执行
<plugins>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.core.version}</version>
<executions>
<execution>
<id>embeddable-stories</id>
<phase>integration-test</phase>
<configuration>
<includes>
<include>**/Stories.java</include>
</includes>
<excludes />
<metaFilters>
<metaFilter>${meta.filter}</metaFilter>
</metaFilters>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
<!-- Copy the resources AFTER the execution is done -->
<execution>
<id>unpack-view-resources</id>
<phase>integration-test</phase>
<configuration>
<viewDirectory>${basedir}/src/main/java/project/reports/{NEED TO FEED DIRECTORY HERE}</viewDirectory>
</configuration>
<goals>
<goal>unpack-view-resources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>