Skip to content

Does not include maven-compiler-plugin's compileSourceRoot configuration #1292

Description

@atl-mk

Affected version

3.12.0

Bug description

This happens with JDK 11, 17, & 21. This does not happen with Java 1.8

I have some classes in both of these folders (long story)

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <compileSourceRoots>
            <compileSourceRoot>${project.basedir}/src/main/java</compileSourceRoot>
            <compileSourceRoot>${project.basedir}/src/main/java2</compileSourceRoot>
        </compileSourceRoots>
    </configuration>
</plugin>

Running mvn clean install and compilation and all the tests work perfectly.

However, running mvn clean install javadoc:jar the javadoc plugin fails with:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.12.0:jar (default-cli) on project example-project: MavenReportException: Error while generating Javadoc: 
[ERROR] Exit code: 1
[ERROR] /home/user/example-project/src/main/java/com/atlassian/example/ExampleFactory.java:14: error: cannot find symbol
[ERROR] public class ExampleFactory extends GenericFactory<ExampleClass> {
[ERROR]                                                                                              ^
[ERROR]   symbol: class ExampleClass
[ERROR] Command line was: /usr/lib/jvm/java-11-openjdk-amd64/bin/javadoc -J-Duser.language= -J-Duser.country= @options @packages

ExampleFactory.java lives in /src/main/java
ExampleClass.java lives in /src/main/java2

I can see from the target folder that all the classes are compiled and present, I would've presumed this would be enough to be on the classpath. Again, I'm not sure why there is a linking difference between JDK 1.8 and 11 either?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions