I have been struggling to increase the memory of my javadoc plugin via my pom file. For some reason my Mac build slave fails during the site goal with an OutOfMemoryError. I tried adjusting the maxmemory of the javadoc plugin via my pluginManagement section of the pom (as per the maven-javadoc-plugin documentation):
...
<build>
...
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<maxmemory>512m</maxmemory>
</configuration>
</plugin>
</plugins>
<pluginManagement>
...
</build>
...
This didn't seem to help anything, my build still failed with an out of memory error.
So I decided to put this directly in my plugin declaration instead (see the build-plugins-plugin section below:
...
<build>
...
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
</plugin>
...
</plugins>
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<maxmemory>512m</maxmemory>
</configuration>
</plugin>
...
</plugins>
...
</build>
...
...and yet this is still not working, the Mac build slave still fails during the site goal.
It turned out I was being an idiot. The site goal uses the plugin defintions declared in the reporting section of the pom. Therefore I had to add my max memory configuration here instead, see below:
...
<build>
...
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
</plugin>
</plugins>
<pluginManagement>
...
</build>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<maxmemory>512m</maxmemory>
</configuration>
</plugin>
</plugins>
</reporting>
...
Based on this result, it is my assumption that Maven will not pick up configuration details defined in the build-pluginManagement section of the pom for plugins defined in the reporting section. Cheers.