Pass command line Params in mvn exec:exec

Two ways to pass command line arguments into mvn:exec:

Method 1, on the command line:

mvn exec:java -Dexec.mainClass="com.myPackage.myClass" -Dexec.args="command line arguments"

Method 2, in the maven POM file:

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <configuration>
        <mainClass>com.myPackage.myClass</mainClass>
        <commandlineArgs>command line arguments</commandlineArgs>
      </configuration>
    </plugin>
  </plugins>
</build>

Then on the command line all you have to do is run:

mvn exec:java

Good luck.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)