Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stale Jars when Updating 'moduleJvmArgs' Stanza #2476

Closed
bmarcaur opened this issue Jan 30, 2023 · 0 comments · Fixed by #2477
Closed

Stale Jars when Updating 'moduleJvmArgs' Stanza #2476

bmarcaur opened this issue Jan 30, 2023 · 0 comments · Fixed by #2477

Comments

@bmarcaur
Copy link
Member

What happened?

When modifying the moduleJvmArgs block in my service I noticed that my tests were continuing to fail. Digging in I noticed that the MANIFEST.MF did not contain my updated exports. To repro:

  1. Add the following to your favorite repo build.gradle:
moduleJvmArgs {
    exports = ['java.base/java.net']
}
  1. Run ./gradlew :MODULE:jar
  2. Open the resultant jar and note the Exports entry in the MANIFEST.MF
  3. Change the previously added stanza to:
moduleJvmArgs {
    exports = ['java.base/java.net123']
}
  1. Run ./gradlew :MODULE:jar
  2. Open the "resultant jar" (its the same) and note the Exports entry in the MANIFEST.MF are unchanged.
  3. Run ./gradlew :MODULE:clean :MODULE:jar
  4. Open the new jar and note the Exports entry in the MANIFEST.MF are now updated.

Digging in to the Gradle build scans I see that Gradle is considering the jar task as UP-TO-DATE. Ping me if you want the links to the Gradle buildscans.

What did you want to happen?

Changing the metadata of the module should invalidate the resulting artifacts and cause Gradle to rebuild the jars.

bjlaub pushed a commit that referenced this issue Jan 30, 2023
The BaselineModuleJvmArgs plugin configures several tasks from the
'java' plugin to use values from the 'moduleJvmArgs' extension (e.g. to
update compiler arguments, output values to the jar manifest, etc.).
However, when the value on the extension changes, those tasks are not
re-run.

To fix that, add input properties for each task that uses moduleJvmArgs
so that when the extension value changes, the task will no longer be
up-to-date.

Fixes #2476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant