Skip to content

mvn clean compile twice in a multi-module reactor fails to resolve upstream module #492

Description

@yeroc

Affected version

1.2.3

Bug description

In a multi-module reactor where a downstream module depends on an upstream module, running mvn clean compile twice fails on the second invocation. The first run populates the cache. The second run gets a cache hit on the upstream, then the downstream's compile fails:

[ERROR] Failed to execute goal on project downstream: Could not resolve dependencies for project example:downstream:jar:1.0-SNAPSHOT
[ERROR] dependency: example:upstream:jar:1.0-SNAPSHOT (compile)
[ERROR]   Could not find artifact example:upstream:jar:1.0-SNAPSHOT

The above can also be reproduced in other ways:

  • mvn clean test-compile twice
  • mvn clean test twice

What works:

  • mvn clean package twice
  • mvn clean verify twice
  • mvn clean followed by mvn compile as separate invocations

So the combination of clean plus a goal that stops before package, in a single invocation, seems to be what triggers it.

Minimal reproducer

parent/
  pom.xml          (packaging=pom, modules: upstream, downstream)
  .mvn/
    extensions.xml (declares maven-build-cache-extension 1.2.3)
    maven-build-cache-config.xml (defaults)
  upstream/
    pom.xml
    src/main/java/example/Upstream.java
  downstream/
    pom.xml        (depends on upstream)
    src/main/java/example/Downstream.java

Steps:

mvn clean compile   # BUILD SUCCESS
mvn clean compile   # BUILD FAILURE

Happy to attach a zip or post a gist with the full project.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions