How can I disable the Maven Javadoc plugin from the command line?
In pom.xml
I have declaration like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar&开发者_StackOverflow中文版lt;/goal>
</goals>
</execution>
</executions>
</plugin>
is there any way to turn that off from command line?
I do know I can extract that into a profile, but that is not what I want.
The Javadoc generation can be skipped by setting the property maven.javadoc.skip
to true
[1], i.e.
-Dmaven.javadoc.skip=true
(and not false
)
It seems, that the simple way
-Dmaven.javadoc.skip=true
does not work with the release-plugin. in this case you have to pass the parameter as an "argument"
mvn release:perform -Darguments="-Dmaven.javadoc.skip=true"
You can use the maven.javadoc.skip
property to skip execution of the plugin, going by the Mojo's javadoc. You can specify the value as a Maven property:
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
or as a command-line argument: -Dmaven.javadoc.skip=true
, to skip generation of the Javadocs.
Add to the release plugin config in the root-level pom.xml:
<configuration>
<arguments>-Dmaven.javadoc.skip=true</arguments>
</configuration>
For newbie Powershell users it is important to know that '.' is a syntactic element of Powershell, so the switch has to be enclosed in double quotes:
mvn clean install "-Dmaven.javadoc.skip=true"
Dans le pom.xml
1st option : using properties
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
2nd option : using the build > pluginManagement > plugins > plugin > configuration
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<goals>deploy</goals>
<arguments>-Dmaven.javadoc.skip=true</arguments>
</configuration>
</plugin>
3rd option : When invoking mvn (this one did not work for me)
mvn clean install -Dmaven.javadoc.skip=true
One important thing is:
if you set <skip>false<skip>
in configuration of maven-javadoc-plugin in pom.xml, the -Dmaven.javadoc.skip=true
will not work, at least for maven-daemon(aka mvndaemon or mvnd).
精彩评论