[英]Is it possible to have two mainClass in the pom.xml or be able to run two classes in the same pom.xml?
我正在研究Java項目。 我們將持續集成與maven 3,svn和Jenkins結合使用。 我們有一個實用程序java項目,其中實現了一些有用的功能。 我們構建了一個jenkins任務來在該項目中運行mainClass。 這是項目pom.xml上的代碼片段:
<plugin>
..
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.ent.uti.Cleaner</mainClass>
<arguments>
<argument>value1</argument>
<argument>value2</argument>
</arguments>
</configuration>
</plugin>
此類在jenkins任務配置中執行:
mvn exec:java -o -f cleaner/pom.xml
我想知道是否可以在同一項目中實現某些功能並在Jenkins中添加其他任務? 是否可以在同一pom.xml配置中具有兩個主要類?
我知道我可以創建另一個項目並在pom中配置mainClass。 我認為這樣做不是一個好主意。 兩個任務都是獨立的,因此不適合一次又一次運行兩個類。
謝謝閱讀。
您可以為此使用配置文件。 所有詳細信息都可以在這里找到: http : //www.jpeterson.com/2009/08/25/using-a-maven-profile-to-run-a-test-program/
然后您的命令行將如下所示:
mvn -P program1 exec:java -o -f cleaner/pom.xml
mvn -P program2 exec:java -o -f cleaner/pom.xml
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.