2013年1月15日火曜日

Additional JVM options for maven-javadoc-plugin

I had a trouble. "mvn release:prepare" generated javadoc not in English but in Japanese.

"mvn release:prepare" invokes maven-javadoc-plugin to generate javadoc. In my local environment, javadoc command uses HTML templates for Japanese unless -Duser.language=en option is given. So, I looked for the way to pass the option to javadoc and finally found it.

Additional JVM options can be passed to maven-javadoc-plugin by adding the block shown below to pom.xml.

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <additionalJOption>-J-Duser.language=en</additionalJOption>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

However, note that, according to maven-javadoc-plugin FAQ, "Where in the pom.xml do I configure the Javadoc Plugin?", places to put configuration for maven-javadoc-plugin at vary depending on your purposes.