 ------
 Running Java programs with the exec goal
 ------
 Jerome Lacoste
 ------
 2008-10-10
 ------

 ~~ Copyright 2008 The Codehaus
 ~~
 ~~ Licensed under the Apache License, Version 2.0 (the "License");
 ~~ you may not use this file except in compliance with the License.
 ~~ You may obtain a copy of the License at
 ~~
 ~~      http://www.apache.org/licenses/LICENSE-2.0
 ~~
 ~~ Unless required by applicable law or agreed to in writing, software
 ~~ distributed under the License is distributed on an "AS IS" BASIS,
 ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ~~ See the License for the specific language governing permissions and
 ~~ limitations under the License.

 ~~ NOTE: For help with the syntax of this file, see:
 ~~ http://maven.apache.org/doxia/references/apt-format.html

Running Java programs with the exec goal

 Special treatment of some command line arguments and configuration parameters facilitate the running of Java programs in external processes.

  Note: with the java mojo, there are some confusion caused by the almost duplication of functionality between the arguments and commandArgs configuration parameters.

  *  If commandLineArgs is specified, it will be used as is, except for replacing %classpath with proper classpath using dependencies

  * Otherwise if the property exec.args is specified, it will be used

  * Otherwise the list of <argument> and <classpath> will be parsed and used

  See {{http://jira.codehaus.org/browse/MEXEC-59}} for discussion.

* Command line

 If specified as part of the <<<exec.args>>> argument, the special string <<<%classpath>>>
 will be replaced by the project classpath as computed by Maven.

-----
mvn exec:exec -Dexec.executable="java" [...] -Dexec.args="%classpath"
-----

* POM configuration

 To execute Java programs, the Exec Plugin helps by allowing the <<<\<classpath\>>>> special argument:

-------------------
        <configuration>
          <executable>java</executable>
          <arguments>
            <argument>-Dmyproperty=myvalue</argument>
            <argument>-classpath</argument>
            <!-- automatically creates the classpath using all project dependencies,
                 also adding the project build directory -->
            <classpath/>
            <argument>com.example.Main</argument>
            ...
          </arguments>
        </configuration>
-------------------

 or if one wants to restrict the dependencies in the classpath:

-------------------
        <configuration>
          <executable>java</executable>
          <arguments>
            <argument>-Dmyproperty=myvalue</argument>
            <argument>-classpath</argument>
            <classpath>
              <dependency>commons-io:commons-io</dependency>
              <dependency>commons-lang:commons-lang</dependency>
            </classpath>
            <argument>com.example.Main</argument>
            ...
          </arguments>
        </configuration>
-------------------
