我需要将属性值从 mvn 命令行导出到稍后我的 java 代码所需的文件。但我总是收到错误:
[错误] 无法在项目 MyApplication 上执行目标 org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties (default-cli):目标 org.codehaus 的参数“outputFile”。 mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties 丢失或无效 -> [帮助 1] [错误]
这是我的项目结构
MyApplication
|src/main/java
|src/main/resources
|src/test/java
|src/test/resources
|lib ////(no files here yet)
|pom.xml
Run Code Online (Sandbox Code Playgroud)
我的 pom.xml 是:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
<configuration><outputFile>${basedir}/lib/build.properties</outputFile>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
注意:我尝试在 lib 文件夹中手动创建空文件 build.properties ,甚至出现相同的错误。也尝试过使用插件版本 1.0.0。
我们有一个CICD流程,其中定义的TC集合始终用于门控流程.有时它不需要运行所有测试,而是我们只想根据开发人员所做的更改来触发一组TC.我们的测试是基于黄瓜的用户故事,因此我们可以通过标签控制测试运行.我的想法是从teamcity的maven命令行参数字段中参数化cucumber.options,并让Dev/support人员根据需要定义标记.
如果我提到命令行参数为
-Dcucumber.options="--tags %env.test.scope%"
Run Code Online (Sandbox Code Playgroud)
我的mavenized项目得到的值为cucumber.options = "--tags @Sanity(假设env.test.scope值为@Sanity).如果你在这里仔细注意,我为什么要打开双引号?它破坏了我的TestRunner并且没有触发任何测试.如果我删除双引号,然后我得到mvn错误,因为@Sanity不被识别为有效目标(因为--tags和@之间的空间问题)如何定义我的参数(cucumber.options)值与空间?
teamcity continuous-integration cucumber continuous-deployment