2017-02-01 5 views
0

Mavenの確実なsuiteXmlFileの可能性

mvn clean test -Dsurefire.suiteXmlFiles=test1.xml,test2.xml,test3.xml,test4.xml,... 

それはいいですが、私はそれがでそれを改善することが可能ですかどうかを知りたいですこれらを含むファイルを読み取る可能性があります。test.xml

これらのテストへの道のりがかなり長くなる可能性があるので、わかりやすくするためにこれを行いたいと思います。

は、だからではなく、その私がこのような何かをしたいと思います:

mvn clean test -Dsurefire.suiteXmlFiles=file.txt 

と内側の私のfile.txt

path/to/my/test1.xml,path/to/my/test2.xml,path/to/my/test3.xml,... 

答えて

1

はい、あなたはプラグインのプロパティを使用する必要があります。

プラグイン

<plugins> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>properties-maven-plugin</artifactId> 
     <version>1.0.0</version> 
     <executions> 
      <execution> 
      <phase>initialize</phase> 
      <goals> 
       <goal>read-project-properties</goal> 
      </goals> 
      <configuration> 
       <files> 
       <file>${propertiesFile}</file> 
       </files> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 

プロパティはねえ、どのようにプロパティファイルへのパスを定義します

test.files = path/to/my/test1.xml,path/to/my/test2.xml,path/to/my/test3.xml 

シュア

<plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.19.1</version> 
     <configuration> 
      <suiteXmlFiles> 
      <suiteXmlFile>${test.files}</suiteXmlFile> 
      </suiteXmlFiles> 
     </configuration> 
     </plugin> 

コマンド

mvn -DpropertiesFile=props.txt properties:read-project-properties clean test 
+0

ファイル? – user3718160

+0

これらの変数はどこで設定しますか:$ {propertiesFile} && $ {test.files} – user3718160

+0

私はmvnコマンドを更新しました。 test.filesはプロパティファイルで定義されています –

関連する問題