Maven Arguments 
(-Dproperty=value)

Maven Arguments (-Dproperty=value)

In Maven, command-line arguments can be passed using the -D flag to set system properties and configuration options. These arguments are often used to customize Maven's behavior during a build process. Here are some commonly used -D arguments for Maven:

  1. -Dproperty=value: Sets a system property to the specified value. For example: -DskipTests=true would skip running tests during the build.

  2. -Dmaven.test.skip=true: Skips running tests during the build. This is equivalent to setting the property skipTests to true.

  3. -Dmaven.compiler.source=version and -Dmaven.compiler.target=version: Sets the Java source and target versions for compilation. Replace version with the desired Java version (e.g., 1.8, 11, 16, etc.).

  4. -Dmaven.repo.local=path: Specifies a custom local repository path for storing downloaded artifacts.

  5. -Dmaven.skip.install=true and -Dmaven.skip.deploy=true: Skips the installation and deployment phases of the build, respectively.

  6. -Dmaven.clean.failOnError=false: Prevents the clean phase from failing the build on error.

  7. -Dmaven.wagon.http.pool=false: Disables connection pooling for HTTP requests made by Maven.

  8. -Dmaven.artifact.threads=n: Sets the number of threads to use when resolving artifacts. Replace n with the desired number.

  9. -Dmaven.verbose=true: Enables verbose output during the build process.

  10. -Dmaven.multiModuleProjectDirectory=path: Specifies the directory where the multi-module project's pom.xml resides when executing a command from a sub-module.

  11. -Dmaven.test.failure.ignore=true: Ignores test failures and allows the build to continue.

  12. -Dmaven.javadoc.skip=true: Skips generating Javadoc during the build.

These are just a few examples of the -D arguments you can use with Maven. You can customize your build process by passing relevant system properties using the -D flag followed by the property and its value. Remember that the available properties may vary depending on the plugins and configurations used in your project. You can also refer to the official Maven documentation and the documentation of any plugins you're using for more information on available options.