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:
-Dproperty=value
: Sets a system property to the specified value. For example:-DskipTests=true
would skip running tests during the build.-Dmaven.test.skip=true
: Skips running tests during the build. This is equivalent to setting the propertyskipTests
totrue
.-Dmaven.compiler.source=version
and-
Dmaven.compiler.target
=version
: Sets the Java source and target versions for compilation. Replaceversion
with the desired Java version (e.g.,1.8
,11
,16
, etc.).-Dmaven.repo.local=path
: Specifies a custom local repository path for storing downloaded artifacts.-Dmaven.skip.install=true
and-Dmaven.skip.deploy=true
: Skips the installation and deployment phases of the build, respectively.-Dmaven.clean.failOnError=false
: Prevents theclean
phase from failing the build on error.-Dmaven.wagon.http.pool=false
: Disables connection pooling for HTTP requests made by Maven.-Dmaven.artifact.threads=n
: Sets the number of threads to use when resolving artifacts. Replacen
with the desired number.-Dmaven.verbose=true
: Enables verbose output during the build process.-Dmaven.multiModuleProjectDirectory=path
: Specifies the directory where the multi-module project's pom.xml resides when executing a command from a sub-module.-Dmaven.test.failure.ignore=true
: Ignores test failures and allows the build to continue.-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.