Maven打包時執行指定的方法


有時候需要在maven打包的時候執行指定的方法,可以通過以下配置來實現

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <phase>test</phase>
            <goals>
                <goal>java</goal>
            </goals>
            <configuration>
                <mainClass>com.umgsai.core.MetaProvider</mainClass>
                <arguments>
                    <argument>xxx-1r</argument>
                    <!--<argument>arg1</argument>-->
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

以上配置表示在maven執行test階段,去執行com.umgsai.core.MetaProvider類的main方法,arguments中配置的是main方法的參數。

參考 https://my.oschina.net/u/2474629/blog/983784


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM