Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .mvn/develocity-custom-user-data.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
buildCache.registerMojoMetadataProvider(context -> {
context.withPlugin("maven-checkstyle-plugin", () -> {
context.inputs(inputs -> {
inputs.fileSet("testSourceDirectories", fileSet ->
fileSet.excludes("**/target/**")
)
})
})
})
Comment on lines +1 to +9
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have https://github.com/hibernate/hibernate-develocity-maven-extension for these. would you want to move it there ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey 👋🏻
I've moved this registration to: hibernate/hibernate-develocity-maven-extension#86

btw why do we exclude target for the test sources only ? (would be nice to have a comment with the reasoning in the code so we won't be guessing what happened in a future 🙂)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I had a plan to do this today but you beat me to it :)

The checkstyle plugin has two file set inputs: sourceDirectories and testSourceDirectories. The problem is specific to test sources because:

Hibernate Search's annotation processor (HibernateSearchProcessor) generates *__.java metamodel files into target/generated-test-sources/test-annotations. This isn't explicitly configured anywhere — it's the default behavior of maven-compiler-plugin when running testCompile
with <proc>full</proc> and the annotation processor (configured in integration test modules like integrationtest/metamodel/orm-lucene/pom.xml). The processor uses the standard Filer API, and Maven automatically directs annotation processor output during test compilation to
that default path. Maven then adds that directory as a test source root, which is how it ends up in checkstyle's testSourceDirectories input.

When Develocity fingerprints testSourceDirectories for checkstyle:check, it picks up target/generated-test-sources/... contents — which only exist after compiler:testCompile runs, making the fingerprint unstable across builds.

Main sourceDirectories don't have this problem — no generated sources under target/ are added as main source roots in those modules.

That's also why the fix in the hibernate-search PR has two parts: the **/target/** exclusion from cache inputs (so generated test sources don't affect the fingerprint), and the **/*__.java checkstyle exclude (so checkstyle doesn't style-check generated code).

That being said, you could also exclude **/target/** for sourceDirectories, there should be no impact there.

1 change: 1 addition & 0 deletions build/parents/build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@
<excludes>
**/Generated.java,**/TypeHelper*.java,**/MatchSuppressor.java,**/CommentSuppressor.java,**/NeverSuppress.java,
**/*_$logger.java,**/*_$bundle.java,
**/*__.java,
**/module-info.java,
**/avro/generated/**/*.java
</excludes>
Expand Down
39 changes: 31 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,6 @@
<!-- The default resource dir: -->
<directory>${project.basedir}/src/main/resources</directory>
</resource>
<resource>
<!-- Extra dir to include the license file: -->
<directory>${rootProject.directory}</directory>
<includes>
<include>LICENSE.txt</include>
</includes>
<targetPath>META-INF</targetPath>
</resource>
</resources>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -1154,6 +1146,37 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<!--
Copy LICENSE.txt to META-INF in the build output directory.
Previously done via a project-level <resource> pointing at ${rootProject.directory},
but that caused the entire workspace root to be fingerprinted as a build cache input
for all goals consuming project resources (e.g. checkstyle:check), breaking
build cache relocatability.
-->
<id>copy-license</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
<resources>
<resource>
<directory>${rootProject.directory}</directory>
<includes>
<include>LICENSE.txt</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down