Skip to content

[Regression] testCompile goal tries to read target/classes instead of target/test-classes #1124

Open

Description

@lprimak

Affected version

3.16.0

Bug description

Starting with 3.16.0, there is a warning printed that suggests wrong target/ directory is being read. This is especially true when there are no classes being compiled from src/main/java and the module contains just tests.

Reproducer: https://github.com/lprimak/maven-test-compiler-reproducer

Error message:

[INFO] --- compiler:3.16.0:testCompile (default-testCompile) @ maven-testng-reproducer ---
[WARNING] I/O error reading dependency state: /Users/lprimak/Downloads/maven-testng-reproducer/target/classes: /Users/lprimak/Downloads/maven-testng-reproducer/target/classes
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 3 source files with javac [debug release 21] to target/test-classes

The issue is reproducible via maven 3.9.16 and 4-rc-6

Activity

  1. added
    bug
    on Sep 7, 2026
  2. cstamas commented on Sep 26, 2026

    @cstamas
    Member

    Same happens on maven-3.10.x (currently):

    [INFO] --- compiler:3.16.0:testCompile (test-compile) @ apache-maven ---
    [WARNING] I/O error reading dependency state: /home/cstamas/Worx/apache-maven/maven-wt/maven-3.10.x/apache-maven/target/classes: /home/cstamas/Worx/apache-maven/maven-wt/maven-3.10.x/apache-maven/target/classes
    [INFO] Recompiling the module because of changed dependency.
    [INFO] Compiling 1 source file with javac [debug deprecation release 8] to target/test-classes
    [WARNING] source value 8 is obsolete and will be removed in a future release
    [WARNING] target value 8 is obsolete and will be removed in a future release
    [WARNING] To suppress warnings about obsolete options, use -Xlint:-options.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions