ARTICLE AD BOX
I have the following in my pom.xml file in an attempt to get Maven to compile my JavaDoc and put it into my projects 'docs' directory. (This is for compatibility with GitHub Pages).
<project> ... <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.12.0</version> <configuration> <outputDirectory>${basedir}/docs</outputDirectory> </configuration> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </buildIt almost works, but it is putting the files in docs/apidocs/ instead of in docs. How can I get it to stop adding the apidocs folder and put the files directly in docs?
My question is different from this question because (1) the person asking that question does not seem to be experiencing the same weird behavior where Maven adds apidocs to the path and (2) the solution proposed there uses settings deprecated in maven-javadoc-plugin version 3.12.
4
I have found a workaround. It's not really a solution, but it avoids the problem.
Delete the 'docs' directory during the clean phase. Generate the Javadoc the default way. Copy the Javadoc from the default output directory into the 'docs' directory during the package phase. <project> ... <plugins> <!-- Delete the /docs folder during the clean phase. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-clean-plugin</artifactId> <version>3.5.0</version> <configuration> <filesets> <fileset> <directory>${basedir}/docs</directory> </fileset> </filesets> <force>true</force> </configuration> </plugin> <!-- Generate Javadoc. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.12.0</version> <executions> <execution> <id>javadoc</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <!-- Copy Javadoc into /docs for GitHub Pages. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/docs</outputDirectory> <resources> <resource> <directory>target/reports/apidocs</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>If nobody answers, I'll eventually mark this as correct, but I'd still prefer a way to solve the actual problem.
Explore related questions
See similar questions with these tags.
