Skip to content

Instantly share code, notes, and snippets.

@JurrianFahner
Last active February 26, 2024 07:03
Show Gist options
  • Save JurrianFahner/be6a82b3b7fb637e226293387dad71d6 to your computer and use it in GitHub Desktop.
Save JurrianFahner/be6a82b3b7fb637e226293387dad71d6 to your computer and use it in GitHub Desktop.
Generate javadoc

Please find below an example pom.xml. To generate the javadoc the following command needs to be run:

mvn javadoc:javadoc

The documentation for the maven-javadoc-plugin can be found here.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>validation-example</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.1</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<source>21</source> <!-- please use a variable instead, e.g. ${maven.compiler.source} -->
<target>21</target> <!-- please use a variable instead, e.g. ${maven.compiler.target} -->
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment