apache / apache/maven-build-cache-extension
`mvn clean compile` twice in a multi-module reactor fails to resolve upstream module
- Dominant language
- Java
- Stars
- 163
- Forks
- 77
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 4
Description
### 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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Create the minimal parent/upstream/downstream reactor described in the issue, including .mvn/extensions.xml and .mvn/maven-build-cache-config.xml. Run mvn clean compile twice first, then compare it with the working package and verify commands while tracing the upstream dependency resolution. Done means the repeated clean compile, test-compile, and test invocations resolve upstream successfully.
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
- Clearly specified
- Newbie friendliness
- 55/100