rtcompile:execute

Full name:

com.github.hypfvieh.java:java-runtime-compiler-maven-plugin:1.0.0-SNAPSHOT:execute

Description:

The execute goal of the Maven plugin compiles the configured list of java sources using the, runtime-compiler and executes the static main method in an optionally configured main class.
The run-time environment must be a JDK (Java Development Kit), so source files may be compiled.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: compile+runtime.
  • The goal is thread-safe and supports parallel builds.
  • Since version: 1.0.0 - 2024-01-25.

Required Parameters

Name Type Since Description
<sourceLocations> List<File> - List of source directories or source files. Directories are scanned recursively for Java files (having a *.java file extension). All other files are ignored.
At least one source file must be found or the plugin will abort your build process with an error.
User Property: sourceLocations

Optional Parameters

Name Type Since Description
<addClassPathElements> boolean - If set to true, all elements of classpathElements will be added to the compile time classpath.
If false, classpathElements will replace the compile time classpath (default).
Default: false
User Property: addClassPathElements
<addTestClassPath> boolean - Adds test classpath to compile/execution classpath.
Default: false
User Property: addClassPathPath
<classOutputDir> File - The output directory to write Java class files to that have been compiled by this plugin.
The directory is created if it not yet exists.
If not configured the directory defaults to the Maven project build directory and the plugin name as subdirectory.

Default: ${project.build.directory}/java-runtime-compiler-maven-plugin/
User Property: classOutputDir
<classpathElements> List<File> - List of paths/files which should be used as classpath instead of the compile time classpath.
The list can either contain files or directories.
The latter will be searched recursively to find all class/jar files.
User Property: classPathElements
<failOnError> boolean - Optional parameter to disable failing of plugin execution when execution of java code fails.
User Property: failOnError
<mainArgs> String[] - Optional array of String arguments to pass to the main method.
User Property: mainArgs
<mainClass> String - The fully qualified name of an optional main class to execute after successful compilation.
The specified class must contain the standard Java static void main() method that takes a String array as its only argument.
User Property: mainClass
<noFork> boolean - Optional parameter to disable forking of JVM. This flag is ignored when called script/program implements a 'setMavenProject' method. When this method is used, the process will never be forked because the MavenProject object would not be available in the forked process.
User Property: noFork
<printClassPath> boolean - Print the used class path when executing code. Defaults to false.

Default: false
User Property: printClassPath
<systemProperties> Properties - Optional array of String arguments to set as system properties.
User Property: systemProperties
<workingDirectory> File - Optional parameter to allow changing the working directory of executed scripts/programs.
User Property: workingDirectory

Parameter Details

<addClassPathElements>

If set to true, all elements of classpathElements will be added to the compile time classpath.
If false, classpathElements will replace the compile time classpath (default).
  • Type: boolean
  • Required: No
  • User Property: addClassPathElements
  • Default: false

<addTestClassPath>

Adds test classpath to compile/execution classpath.
  • Type: boolean
  • Required: No
  • User Property: addClassPathPath
  • Default: false

<classOutputDir>

The output directory to write Java class files to that have been compiled by this plugin.
The directory is created if it not yet exists.
If not configured the directory defaults to the Maven project build directory and the plugin name as subdirectory.
  • Type: java.io.File
  • Required: No
  • User Property: classOutputDir
  • Default: ${project.build.directory}/java-runtime-compiler-maven-plugin/

<classpathElements>

List of paths/files which should be used as classpath instead of the compile time classpath.
The list can either contain files or directories.
The latter will be searched recursively to find all class/jar files.
  • Type: java.util.List<java.io.File>
  • Required: No
  • User Property: classPathElements

<failOnError>

Optional parameter to disable failing of plugin execution when execution of java code fails.
  • Type: boolean
  • Required: No
  • User Property: failOnError

<mainArgs>

Optional array of String arguments to pass to the main method.
  • Type: java.lang.String[]
  • Required: No
  • User Property: mainArgs

<mainClass>

The fully qualified name of an optional main class to execute after successful compilation.
The specified class must contain the standard Java static void main() method that takes a String array as its only argument.
  • Type: java.lang.String
  • Required: No
  • User Property: mainClass

<noFork>

Optional parameter to disable forking of JVM. This flag is ignored when called script/program implements a 'setMavenProject' method. When this method is used, the process will never be forked because the MavenProject object would not be available in the forked process.
  • Type: boolean
  • Required: No
  • User Property: noFork

<printClassPath>

Print the used class path when executing code. Defaults to false.
  • Type: boolean
  • Required: No
  • User Property: printClassPath
  • Default: false

<sourceLocations>

List of source directories or source files. Directories are scanned recursively for Java files (having a *.java file extension). All other files are ignored.
At least one source file must be found or the plugin will abort your build process with an error.
  • Type: java.util.List<java.io.File>
  • Required: Yes
  • User Property: sourceLocations

<systemProperties>

Optional array of String arguments to set as system properties.
  • Type: java.util.Properties
  • Required: No
  • User Property: systemProperties

<workingDirectory>

Optional parameter to allow changing the working directory of executed scripts/programs.
  • Type: java.io.File
  • Required: No
  • User Property: workingDirectory