Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven javadoc.skip=true throws an error

Tags:

java

maven

I am trying to build a project of mine using the javadoc.skip parameter

mvn clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -Pbpfle

But I keep getting an error saying

Unknown life cycle phase ".javadoc.skip=true". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.

I am using Java (JDK) 8 with Maven 3.3.3

Is it an issue with Java because it used to work when I used to work with JDK 7 (and the same version of Maven)? I am running the command in Windows PowerShell.

like image 563
thisisshantzz Avatar asked Jun 27 '16 10:06

thisisshantzz


People also ask

How do I fix Javadoc error?

You need to call mvn javadoc:fix to fix main Java source files (i.e. inside src/main/java directory) or mvn javadoc:test-fix to fix test Java source files (i.e. inside src/test/java directory).

What is Maven Javadoc skip?

skip Option. The Maven Javadoc plugin has provided a maven. javadoc. skip option to skip the Javadoc generation. Our Maven build won't generate Javadocs if we pass this option with the value true when we build our project: mvn clean install -Dmaven.javadoc.skip=true.

Which will prevent Javadoc from being generated while using Doclint?

The magic incantation you need is -Xdoclint:none . This goes on the command line invoking Javadoc.

What is Maven Javadoc?

The Javadoc Plugin uses the Javadoc tool to generate javadocs for the specified project. For more information about the standard Javadoc tool, please refer to Reference Guide. The Javadoc Plugin gets the parameter values that will be used from the plugin configuration specified in the pom.


2 Answers

The problem is actually related to how you are launching the Maven command. In Windows Powershell, the dot . has a special meaning, so it gets interpreted, just like the dash -.

You will need to escape all those characters using a backtick `, like so:

mvn clean install `-Dmaven`.javadoc`.skip=true `-Dmaven`.test`.skip=true `-Pbpfle
like image 165
Tunaki Avatar answered Oct 19 '22 04:10

Tunaki


It seems to work when I replace the -Dmaven.javadoc.skip=true with -D maven.javadoc.skip=true

Basically adding a whitespace between the -D and maven. But I thought it wasn't required.

EDIT : This issue was coming up in the Windows powershell only. Adding the whitespaces in the powershell seems to make the command work. In the traditional command prompt, no whitespaces are required and the command works they way I was trying it initially.

like image 3
thisisshantzz Avatar answered Oct 19 '22 05:10

thisisshantzz