9

I'm working on a maven project and want to generate the most basic of javadocs.

This is the plugin I add to my pom.xml

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.8.1</version>
        <executions>
            <execution>
                <id>attach-javadocs</id>
                <phase>package</phase>
                <goals>
                    <goal>jar</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>
</build>

I then run the goal mvn clean package and after successfully cleaning and packaging my project it says

[INFO] --- maven-javadoc-plugin:2.8.1:jar (attach-javadocs) @ project-name ---
[INFO] Skipping javadoc generation.

I've tried adding the property:

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

And have also tried this in cmd prompt:

mvn clean package -Dmaven.javadoc.skip=false

No different...

Anything I am blatantly missing?

Daniel
  • 105
  • 1
  • 2
  • 5
  • Have you configured the `org.apache.maven.plugins:maven-javadoc-plugin` under the `build` or `reporting`? – Charlee Chitsuk Mar 25 '13 at 02:13
  • Sorry, yeah it's under build. – Daniel Mar 25 '13 at 02:14
  • 1
    Could you try two things? Use the latest (`2.9`) version of the javadoc plugin? Also omit the `phase` configuration as per [this cookbook](http://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html)? – Raghuram Mar 25 '13 at 02:30
  • 1
    Due to network restrictions I cannot get to 2.9. The version 2.8.1 works on another PC I have tried it on. So I'm quite sure that it's not to do with the version. Also after removing the phase configuration... same outcome. – Daniel Mar 25 '13 at 02:39
  • can run mvn with -X option and post the relevant output ? – ben75 Mar 25 '13 at 09:04

2 Answers2

13

You must use

-Dmaven.javadoc.skip=true <-- to skip javadoc

-Dmaven.javadoc.skip=false <<-- do not skip

Davit Tvildiani
  • 1,915
  • 3
  • 19
  • 29
8

see the effective pom of your project either on the command line by typing mvn help:effective-pom or through eclipse effective-pom view of your pom. That will give you the true configuration. If the flag is set to true, then:

  1. are you adding the configuration in an inactive profile? check mvn help:active-profiles
  2. do you have pom inheritance and inheriting the configuration from the parents? check parent poms

I don't think that changing the version will help you much as the "skip" parameter was available from version 2.5

Tekdev
  • 448
  • 3
  • 9
  • I did the mvn help:effective-pom and saw true under the javadocs plugin configuration. So I added false into my javadoc plugin configuration in my POM files and its now working :) Thanks a lot – Daniel Mar 28 '13 at 01:10
  • Oh, and to answer your 2nd question.. I do actually have my parent pom referencing another parent pom. I'll check its configuration – Daniel Mar 28 '13 at 01:17
  • And sure enough... that's where its set to true. I see now haha.. Problem solved. – Daniel Mar 28 '13 at 01:18