apache / apache/maven-javadoc-plugin

Test-Classpath ignores Runtime dependencies in Multi-Module-Projects

Open
#1,314 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
107
Forks
116
Avg merge
1d 10h
Merged PRs (30d)
16

Description

### Affected version

3.12.0

### Bug description

When creating a Test Javadoc report in a Multi-Module-Project, Runtime dependencies in modules are not properly considered when creating the classpath for test classes.

# Steps to Reproduce

You need just two POMs and one Java class.

Main Project **pom.xml**:
```xml

4.0.0
some.group.id
multi-module-parent
0.0.1-SNAPSHOT
pom

module




org.apache.maven.plugins
maven-javadoc-plugin
3.12.0

package



```
Module in **module/pom.xml**:
```xml

4.0.0

some.group.id
multi-module-parent
0.0.1-SNAPSHOT

module



net.minidev
json-smart
2.6.0
runtime

```
Test class in **src/main/java/example/Example.java**:
```java
package example;

import net.minidev.json.JSONArray;

public class Example {

void test() {
System.out.println(JSONArray.class);
}
}
```

# Expected Behavior

The project should compile fine and the report should be created normally.

# Actual Behavior

The project compiles fine, but the report fails with an error:

> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.12.1:site (default-site) on project multi-module-parent: Error generating maven-javadoc-plugin:3.12.0:test-aggregate report:
> [ERROR] Exit code: 1
> [ERROR] C:\devel\Eclipse\eclipse-2025-12\workspace\bar\module\src\test\java\example\Example.java:3: error: package net.minidev.json does not exist
> [ERROR] import net.minidev.json.JSONArray;

# Suspected Reason

According to the [Maven Documentation](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html), the "Runtime" scope means that "Maven includes a dependency with this scope in the runtime and test classpaths, but not the compile classpath". This seems to work fine if it's a a single module, but maven-javadoc-plugin gets its wires crossed when determining the classpath for the actual report.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the main pom.xml, module/pom.xml, and src/main/java/example/Example.java using the test-aggregate report. Trace how the report builds the test classpath for the multi-module project, then verify that the runtime dependency is included and the report completes without the missing-package error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.