(十三)exec-maven-plugin配置及使用

原文链接:https://www.cnblogs.com/lianshan/p/7358966.html

背景:

如果你想在项maven生命周期内,运行一段java代码,或者一段独立的程序,或者说我们所指的预执行,初始化某些值,生成某些不能预先生成的文件。
那么这样我们就可以使用exec-maven-plugin进行程序的预执行,生成相关文件。
具体配置如下:

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>            <!-- java还是exec-->
                        </goals>
                        <phase>compile</phase>              <!--生命周期-->
                    </execution>
                </executions>
                <configuration>
                    <mainClass>com.sf.ucmp2.doclet.Main</mainClass>        <!--程序入口,主类名称-->
                    <arguments>
                        <argument>-encoding</argument>                          <!--相关参数-->
                        <argument>utf-8</argument>
                    </arguments>
                    <classpathScope>compile</classpathScope>
                </configuration>
            </plugin>

  

原文地址:https://www.cnblogs.com/lvchengda/p/13048237.html