maven pom.xml配置啓動Java程序
java
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <executable>java</executable> <!-- executable指的是要執行什麼樣的命令 --> <arguments> <argument>-DsystemProperty1=value1</argument> <!-- 這是一個系統屬性參數 --> <argument>-DsystemProperty2=value2</argument> <!-- 這是一個系統屬性參數 --> <argument>-XX:MaxPermSize=256m</argument> <!-- 這是一個JVM參數 --> <!--automatically creates the classpath using all project dependencies, also adding the project build directory --> <argument>-classpath</argument> <!-- 這是classpath屬性,其值就是下面的<classpath/> --> <classpath/> <!-- 這是exec插件最有價值的地方,關於工程的classpath並不須要手動指定, 它將由exec自動計算得出 --> <argument>com.yourcompany.app.Main</argument> <!-- 程序入口,主類名稱 --> <argument>arg1</argument> <!-- 程序的第一個命令行參數 --> <argument>arg2</argument> <!-- 程序的第二個命令行參數 --> </arguments> </configuration> </plugin>