Skip to content

Build: avoid empty directories in JARs - #5487

Draft
ajantha-bhat wants to merge 1 commit into
apache:mainfrom
ajantha-bhat:codex/fix-empty-jar-license-directories
Draft

Build: avoid empty directories in JARs#5487
ajantha-bhat wants to merge 1 commit into
apache:mainfrom
ajantha-bhat:codex/fix-empty-jar-license-directories

Conversation

@ajantha-bhat

Copy link
Copy Markdown
Member

Summary

Avoid adding empty gradle/ and gradle/jar-licenses/ directories to JARs when copying LICENSE and NOTICE into META-INF.

Problem

The existing copy configuration starts at the repository root. Gradle retains the source directories as empty JAR entries:

META-INF/LICENSE
META-INF/NOTICE
gradle/
gradle/jar-licenses/

Fix

Copy the legal files directly from gradle/jar-licenses into META-INF for shared Java JARs and the Spark 3.5 and 4.0 JARs. Spark bundle JAR handling is unchanged.

Verification

  • Confirmed main, sources, and Javadoc JARs contain exactly one META-INF/LICENSE and META-INF/NOTICE.
  • Confirmed gradle/ and gradle/jar-licenses/ are absent after the fix.
  • Confirmed custom module LICENSE handling is preserved.
  • Confirmed Spark bundle JARs still contain their customized legal files.
  • ./gradlew spotlessCheck passes.

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

@@ -222,16 +222,12 @@ tasks.withType<Jar>().configureEach {

if (!project.file("src/main/no-license-notice-marker").exists()) {
if (!project.file("src/main/resources/META-INF/LICENSE").exists()) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Found during polaris tools release

apache/polaris-tools#270

@ajantha-bhat ajantha-bhat changed the title fix(build): avoid empty directories in JARs Build: avoid empty directories in JARs Sep 10, 2026
@ajantha-bhat

Copy link
Copy Markdown
Member Author

I will take a look at flaky test later.

@ajantha-bhat
ajantha-bhat marked this pull request as draft September 10, 2026 15:23
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 this pull request may close these issues.

1 participant