Program Arguments

Arguments for Program

If you have created a script it's sometimes useful to have supplemental arguments which can be given to the Java application by using the following configuration.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        ...
       <configuration>
          <programs>
            <program>
              <mainClass>com.mycompany.app.App</mainClass>
              <commandLineArguments>
                <commandLineArgument>arg1</commandLineArgument>
                <commandLineArgument>arg2</commandLineArgument>
              </commandLineArguments>
              <id>app</id>
            </program>
          </programs>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Based on the above configuration your generated script will look like this (only an excerpt):

#!/bin/sh
.
.
exec "$JAVACMD" $JAVA_OPTS \
  $EXTRA_JVM_ARGUMENTS \
  -classpath "$CLASSPATH" \
  -Dapp.name="app" \
  -Dapp.pid="$$" \
  -Dapp.repo="$REPO" \
  -Dbasedir="$BASEDIR" \
  com.mycompany.app.App \
  arg1 arg2 "$@"