6

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.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
thisisshantzz
  • 1,067
  • 3
  • 13
  • 33
  • Maybe a space character between `-Dmaven` and `.javadoc.skip=true`? This would Maven let interpret the `.javadoc.skip=true` part as a phase (like "clean" and "install"). – Seelenvirtuose Jun 27 '16 at 10:43
  • It seems to work if I replace the -Dmaven.javadoc.skip=true with -D maven.javadoc.skip=true and it seems to work. How did the whitespace become important now? – thisisshantzz Jun 27 '16 at 10:50
  • Are you sure it really works addint a space? there shouldn't be any space in there, actually the space should break it – A_Di-Matteo Jun 27 '16 at 10:54
  • Yes, I am sure it didn't work when I had not put that whitespace and it started to work when I did add the whitespace. – thisisshantzz Jun 27 '16 at 10:58

2 Answers2

4

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
Community
  • 1
  • 1
Tunaki
  • 132,869
  • 46
  • 340
  • 423
  • Its funny. I tried running the same command (no whitespaces between -D and javadoc) in the traditional command prompt and it works. I guess it is some powershell issue. I guess the powershell parses command arguments differently when compared to the traditional command prompt. – thisisshantzz Jun 27 '16 at 11:27
  • @thisisshantzz Yeah it does. I linked to questions relating to those operators if you want to dig more :). – Tunaki Jun 27 '16 at 11:28
3

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.

thisisshantzz
  • 1,067
  • 3
  • 13
  • 33