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