(十三)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>

  


免責聲明!

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



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