Skip to content

Add Automatic-Module-Name jar manifests#15959

Open
jamesfredley wants to merge 1 commit into
8.0.xfrom
feat/automatic-module-names
Open

Add Automatic-Module-Name jar manifests#15959
jamesfredley wants to merge 1 commit into
8.0.xfrom
feat/automatic-module-names

Conversation

@jamesfredley

Copy link
Copy Markdown
Contributor

Description

What was found

Problem Impact
Published jars lack Automatic-Module-Name Poor JPMS readiness
Google Doc 6.2 listed this as low-risk 8.x step Easy starter before full module-info
Manual per-module names would drift Needs build-logic convention

What changed

Area Change
Build-logic Generate Automatic-Module-Name in jar manifests
Convention Applied through CompilePlugin/build conventions
Docs Upgrade note describing module names
Tests Build-logic coverage for manifest attribute

Out of scope / follow-up

Topic Status
Full module-info.java Later
Split-package remediation Later
Consumer module-path validation suite Follow-up

Related MD topics

Source Topic
Google Doc 6.2 JPMS module-system readiness

Contributor Checklist

Issue and Scope

  • Low-risk JPMS readiness starter.
  • No module-info rewrite.
  • Single focused change.
  • Targets 8.0.x.

Code Quality

  • Tests added.
  • Focused build-logic tests run.
  • No mass reformatting.
  • AI starting point labeled.

Licensing and Attribution

  • Apache License 2.0.
  • Contributor rights confirmed.
  • ai-generated-starting-point label applied.

Documentation

  • Upgrade note added.
  • Scope explained.

Assisted-by: Sisyphus:xai/grok-4.5 [gpt-coding]

Generate Automatic-Module-Name entries from build-logic for published modules.

Assisted-by: Sisyphus:xai/grok-4.5 [gpt-coding]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds JPMS-friendly Automatic-Module-Name entries to jar manifests via the shared build-logic compile convention, and documents the resulting module naming scheme in the upgrade guide.

Changes:

  • Add Automatic-Module-Name manifest attribute generation to CompilePlugin and introduce a derived/overridable module-name helper.
  • Add build-logic test coverage for the module-name derivation helper.
  • Document automatic module naming and link it into the docs table of contents.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
grails-doc/src/en/guide/upgrading/automaticModuleNames.adoc New upgrade note describing automatic module-name manifest entries and naming rules.
grails-doc/src/en/guide/toc.yml Adds the new upgrade note to the docs navigation.
build-logic/plugins/src/test/groovy/org/apache/grails/buildsrc/CompilePluginSpec.groovy Adds tests for automaticModuleName(Project) derivation and override.
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy Adds Automatic-Module-Name manifest attribute logic and the automaticModuleName helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +86 to +88
if (!jar.archiveClassifier.present) {
jar.manifest.attributes('Automatic-Module-Name': automaticModuleName(project))
}

class CompilePluginSpec extends Specification {

void 'automatic module name is derived from group and project name'() {
@@ -0,0 +1,7 @@
=== Automatic module names

Grails 8.1 starts publishing `Automatic-Module-Name` manifest entries for the main framework jars produced by the shared compile convention.
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.5654%. Comparing base (b00e83e) to head (7f4e24d).
⚠️ Report is 8 commits behind head on 8.0.x.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##                8.0.x     #15959        +/-   ##
==================================================
+ Coverage     49.5403%   49.5654%   +0.0251%     
- Complexity      16922      16929         +7     
==================================================
  Files            1999       1999                
  Lines           93754      93753         -1     
  Branches        16420      16419         -1     
==================================================
+ Hits            46446      46469        +23     
+ Misses          40145      40118        -27     
- Partials         7163       7166         +3     

see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jdaugherty

jdaugherty commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

We cannot do this PR because we have overlapping module names. Until we repackage all of our jars, we cannot proceed here and thus is why we've excluded this information to date (we don't want to give the appearance we're compatible with JPMS until we actually are).

@testlens-app

testlens-app Bot commented Jul 10, 2026

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

CI - Groovy Joint Validation Build / build_grails > :grails-test-examples-spring-security-core-misc-functional-test-app-group:integrationTest

Test Runs Flakiness
SecuredControllerSpec > test login as sherlock, sherlock belongs to detective groups. All detectives have the role ADMIN 0% 🟢

🏷️ Commit: 7f4e24d
▶️ Tests: 12547 executed
⚪️ Checks: 60/60 completed

Test Failures

SecuredControllerSpec > test login as sherlock, sherlock belongs to detective groups. All detectives have the role ADMIN (:grails-test-examples-spring-security-core-misc-functional-test-app-group:integrationTest in CI - Groovy Joint Validation Build / build_grails)
Condition not satisfied:

pageSource.contains('you have ROLE_ADMIN')
|          |
|          false
<html lang="en" class="no-js"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>
        Login
    </title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
	<meta name="layout" content="main">
	
	<style type="text/css" media="screen">
 
	#login {
		margin: 15px 0px;
		padding: 0px;
		text-align: center;
		font-family: Arial, Helvetica, sans-serif;
	}
 
	#login .inner {
		width: 340px;
		padding-bottom: 6px;
		margin: 60px auto;
		text-align: left;
		border: 1px solid #aab;
		background-color: #f0f0fa;
		-moz-box-shadow: 2px 2px 2px #eee;
		-webkit-box-shadow: 2px 2px 2px #eee;
		-khtml-box-shadow: 2px 2px 2px #eee;
		box-shadow: 2px 2px 2px #eee;
	}
 
	#login .inner .fheader {
		padding: 18px 26px 14px 26px;
		background-color: #f7f7ff;
		margin: 0px 0 14px 0;
		color: #2e3741;
		font-size: 18px;
		font-weight: bold;
	}
 
	#login .inner .cssform p {
		clear: left;
		margin: 0;
		padding: 4px 0 3px 0;
		padding-left: 105px;
		margin-bottom: 20px;
		height: 1%;
	}
 
	#login .inner .cssform input[type="text"] {
		width: 75%;
	}
 
	#login .inner .cssform label {
		font-weight: bold;
		float: left;
		text-align: right;
		margin-left: -105px;
		width: 110px;
		padding-top: 3px;
		padding-right: 10px;
	}
 
	#remember_me_holder {
		padding-left: 120px;
	}
 
	#submit {
		margin-left: 15px;
	}
 
	#remember_me_holder label {
		float: none;
		margin-left: 0;
		text-align: left;
		width: 200px
	}
 
	#login .inner .login_message {
		padding: 6px 25px 20px 25px;
		color: #c33;
	}
 
	#login .inner .text_ {
		width: 75%;
	}
 
	#login .inner .chk {
		height: 12px;
	}
 
	#passwordToggler {
		padding: 3px 4px;
		cursor: pointer;
	}
	</style>
 
</head>
<body>
 
<div id="login">
	<div class="inner">
		<div class="fheader">Please Login</div>
 
		
 
		<form action="/login/authenticate" method="POST" id="loginForm" class="cssform" autocomplete="off">
			<p>
				<label for="username">Username:</label>
				<input type="text" class="text_" name="username" id="username" autocapitalize="none">
			</p>
 
			<p>
				<label for="password">Password:</label>
				<input type="password" class="text_" name="password" id="password">
				<i id="passwordToggler" title="toggle password display" onclick="passwordDisplayToggle()">👁</i>
			</p>
 
			<p id="remember_me_holder">
				<input type="checkbox" class="chk" name="remember-me" id="remember_me">
				<label for="remember_me">Remember me</label>
			</p>
 
			<p>
				<input type="submit" id="submit" value="Login">
			</p>
		</form>
	</div>
</div>
<script type="text/javascript">
	document.addEventListener("DOMContentLoaded", function(event) {
		document.forms['loginForm'].elements['username'].focus();
	});
 
	function passwordDisplayToggle() {
		var toggleEl = document.getElementById("passwordToggler");
		var eyeIcon = '\u{1F441}';
		var xIcon = '\u{2715}';
		var passEl = document.getElementById("password");
 
		if (passEl.type === "password") {
			toggleEl.innerHTML = xIcon;
			passEl.type = "text";
		} else {
			toggleEl.innerHTML = eyeIcon;
			passEl.type = "password";
		}
	}
</script>
 
 
 
</body></html>

	at demo.SecuredControllerSpec.$tt__$spock_feature_1_0(SecuredControllerSpec.groovy:52)
	at demo.SecuredControllerSpec.test login as sherlock, sherlock belongs to detective groups. All detectives have the role ADMIN_closure2(SecuredControllerSpec.groovy)
	at grails.gorm.transactions.GrailsTransactionTemplate$1.doInTransaction(GrailsTransactionTemplate.groovy:72)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:137)
	at grails.gorm.transactions.GrailsTransactionTemplate.executeAndRollback(GrailsTransactionTemplate.groovy:69)
	at demo.SecuredControllerSpec.test login as sherlock, sherlock belongs to detective groups. All detectives have the role ADMIN(SecuredControllerSpec.groovy)

Muted Tests

Select tests to mute in this pull request:

  • SecuredControllerSpec > test login as sherlock, sherlock belongs to detective groups. All detectives have the role ADMIN

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants