Skip to content

[MBUILDCACHE-45] Compiled classes are not copied/restored to target, causing higher phase builds to fail #259

@jira-importer

Description

@jira-importer

Miguel Ortega opened MBUILDCACHE-45 and commented

+Step to reproduce+

  1. Execute a first command on a pristine projet( NO CACHE has ever been stored)
mvn test

Results are cached (contrary to documentation that states that "cache will kick-in automatically on every lifecycle build of phase package or higher.") This could also be a feature since tests can be skipped if nothing changes.
2 . But if I run next: 

mvn clean verify
#OR
mvn clean install

Then the build fails

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.2:repackage (repackage) on project demo: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:3.0.2:repackage failed: Unable to find main class -> [Help 1]
[ERROR]
 

The root cause seems to be that after "clean", the maven target directory is cleaned and even if the cache is detected, classes are not restored to the target folder anymore

[INFO] Attempting to restore project com.example:demo from build cache
[INFO] Remote cache is incomplete or missing, trying local build for com.example:demo
[INFO] Local build found by checksum 596f60b3f5056d7d
[INFO] Found cached build, restoring com.example:demo from cache by checksum 596f60b3f5056d7d
[INFO] Project com.example:demo restored partially. Highest cached goal: test, requested: install
[INFO] Skipping plugin execution (cached): resources:resources
[INFO] Skipping plugin execution (cached): compiler:compile
[INFO] Skipping plugin execution (cached): resources:testResources
[INFO] Skipping plugin execution (cached): compiler:testCompile
[INFO] Skipping plugin execution (cached): surefire:test 

+Workaround+

Manually remove cache data or disable cache via command line argument

+Environment+

Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: <REDACTED>
Java version: 17.0.1, vendor: Eclipse Adoptium, runtime: <REDACTED>
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Attachments:

2 votes, 8 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:majorMajor loss of function

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions