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方法的参数。

猜你喜欢

转载自www.cnblogs.com/umgsai/p/11918802.html