1

In my project, I am trying to skip javadoc plugin entirely when running mvn --batch-mode clean release:prepare and mvn --batch-mode release:perform. Yet, adding

    <properties>
        <maven.javadoc.skip>true</maven.javadoc.skip>
    </properties>

does not prevent javadoc from being executed. I don't even ever mention javadoc in root pom.xml. Using maven option -Dmaven.javadoc.skip=true or -Darguments="-Dmaven.javadoc.skip=true" doesn't help either.

My pom.xml does not have parent poms. The version of maven-javadoc-plugin is displayed as 3.3.0.

The error I am trying to address is:

[INFO] java.lang.TypeNotPresentException: Type org.apache.maven.plugins.javadoc.JavadocJar not present
... the usual part of mess of a stack trace skipped ...
[INFO] Caused by: java.lang.UnsupportedClassVersionError: org/apache/maven/plugins/javadoc/JavadocJar : Unsupported major.minor version 52.0
[INFO]  at java.lang.ClassLoader.defineClass1(Native Method)

I did not even define the <plugin> part in the config to run javadoc. Interestingly, adding the following snipped still causes 3.3.0 javadoc to be ran!

      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.7</version>
      </plugin>

What else can be attempted to disable the javadoc plugin from running entirely?

Zloj
  • 2,235
  • 2
  • 18
  • 28
  • Weird, according this doc it should get skipped: https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#skip Are you sure you're using a recent version of the javadoc plugin that has that feature? – Geoffrey De Smet Sep 03 '21 at 13:48
  • Does your project POM extend a ``? And if yes, does that POM (or one of its parents...) hardcode that property to false, e.g. `false`, either in `` or directly in a plugin config block? This type of config would prevent the property setting from having any effect. – user944849 Sep 03 '21 at 13:50
  • @user944849 My pom.xml does not have parent poms. – Zloj Sep 03 '21 at 14:05
  • @GeoffreyDeSmet The version of maven-javadoc-plugin is displayed as 3.3.0. The error I am trying to address is edited into the question now. I did not even define the part in the config to run javadoc. Interestingly, adding the following snipped still causes 3.3.0 javadoc to be ran! maven-javadoc-plugin 2.7 – Zloj Sep 03 '21 at 14:06
  • 1
    Pls run `mvn help:effective-pom` and report the javadoc-plugin related snippets – guido Sep 03 '21 at 15:21
  • @guido inside the build block: ` maven-javadoc-plugin2.7` Inside the properties block: `true` – Zloj Sep 03 '21 at 15:27
  • just noticed you are using maven-release; maven-release runs mvn in mvn for you (preforming the release), you need to add the `-Dmaven.javadoc.skip=true` as an argument in the configuration for maven-release-plugin. Check here: https://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#arguments – guido Sep 03 '21 at 15:31

1 Answers1

1

Note that you have this error:

Caused by: java.lang.UnsupportedClassVersionError: org/apache/maven/plugins/javadoc/JavadocJar : Unsupported major.minor version 52.0
[INFO]  at java.lang.ClassLoader.defineClass1(Native Method)

which means that the version of Java you use to run Maven with is too old. See Unsupported major.minor version 52.0 for details.

Fix this so the javadoc plugin loads properly and then can recognize the system property you provide and not do anything further.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347