[ https://issues.apache.org/jira/browse/MBUILDCACHE-106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17877444#comment-17877444 ]
ASF GitHub Bot commented on MBUILDCACHE-106: -------------------------------------------- reda-alaoui commented on code in PR #178: URL: https://github.com/apache/maven-build-cache-extension/pull/178#discussion_r1734881627 ########## src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java: ########## @@ -892,6 +892,18 @@ private void restoreGeneratedSources(Artifact artifact, Path artifactFilePath, M Files.createDirectories(outputDir); } CacheUtils.unzip(artifactFilePath, outputDir); + OutputType outputType = OutputType.fromClassifier(artifact.getClassifier()); + if (outputType != OutputType.GENERATED_SOURCE) { + return; + } + Path targetDir = Paths.get(project.getBuild().getDirectory()); + if (outputDir.equals(targetDir.resolve("generated-sources")) Review Comment: The bug fixed by this PR can emerge with https://github.com/apache/maven-build-cache-extension/pull/177 merged. If reconciliation is done like proposed in https://github.com/apache/maven-build-cache-extension/pull/177, we can have the following situation. A project uses an annotation processor to generate some java files. A cached entry exists and comes from a `verify -DskipTests`. The new build `verify` reuses this entry by skipping all plugin executions preceding `maven-surefire-plugin`. Among the skipped executions is `compiler:compile`. After the tests comes `maven-javadoc-plugin`. When `maven-javadoc-plugin`, the build fails because `maven-javadoc-plugin` is unable to find the source files of the compiled `generated-sources`. This is because `maven-javadoc-plugin` expects `maven-compiler-plugin` to have enriched the maven context with the additional source roots. But since this later was skipped by the cache, additional source roots are missing. > Missing compile source roots matching 'generated-sources' and > 'generated-test-sources' when compiler is skipped > --------------------------------------------------------------------------------------------------------------- > > Key: MBUILDCACHE-106 > URL: https://issues.apache.org/jira/browse/MBUILDCACHE-106 > Project: Maven Build Cache Extension > Issue Type: Bug > Reporter: Réda Housni Alaoui > Priority: Major > Labels: pull-request-available > -- This message was sent by Atlassian Jira (v8.20.10#820010)