![](/img/trans.png)
[英]How to convert a maven plugin into a gradle plugin (maven-surefire-puglin )?
[英]How to convert maven surefire into gradle?
在遷移之前,我可以在 mvn test -D.. 中設置 -Darguments 。構建是從 surefire 開始的,但在 Gradle 中我做不到
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<includes>
<include>**/RunCucumberIT.java</include>
<release>11</release>
</includes>
<parallel>methods</parallel>
<threadCount>${parallel.count}</threadCount>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-Xmx2048m
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
遷移后
dependencies {
compile 'org.apache.maven.plugins:maven-surefire-plugin:2.21.0'
}
test {
ignoreFailures = true
include '**/RunCucumberIT.java'
//option doesn't works
//options {
//parallel = "methods"
//forkCount = 4
}
}
我需要並行運行它,而且-Darguments=someArgument也不起作用
您需要在 Gradle 任務中設置系統屬性。
例子:
task <task_name> {
systemProperty "arguments", System.getProperty("arguments")
}
現在應用程序可以讀取 -Darguments=someArgument
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.