• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 28336942568

28 Jun 2026 09:42PM UTC coverage: 92.802% (+0.007%) from 92.795%
28336942568

push

github

web-flow
Support configuring nailgun server jar and add support for java agent implemention (#23405)

Nailgun is deprecated and will not work for Java versions past 17.
This is because the SecurityManager API has been deprecated
and removed from recent Java versions, which is used for a
fundamental mechanism in Nailgun to avoid exiting the server
when user code exits.

Some previous mentions on this issue:
https://github.com/pantsbuild/pants/issues/20603
https://github.com/pantsbuild/pants/issues/22580
https://github.com/pantsbuild/pants/pull/22533

I went ahead and forked Nailgun over at
https://github.com/soundtrackyourbrand/nailgun and reworked
the deprecated mechanism which adds support for all modern
Java versions without requiring any structural changes to the
client side in Pants. The fork uses a light weight Java Agent that
rewrites the bytecode to trap exit calls, which allows removing
all use of the SecurityManager.

However, instead of just swapping over, it would make sense to be able
to test it out for a while. So I've suggested adding some options here
to make it configurable which nailgun-server to use. It also includes an
option to run a Java Agent with the nailgun server which is required for
the fixed implementation of nailgun itself.

I've made the fork public, but it's only on GitHub packages at the
moment. To make use of it in Pants there is some configuration needed
```
[jvm]
nailgun_enable_agent = true
nailgun_group = "com.soundtrackyourbrand"
nailgun_artifact = "nailgun-server"
nailgun_version = "1.1.0"
nailgun_main_class = "com.facebook.nailgun.NGServer"
nailgun_sha256 = "8c70e8a81189833aff8e4c1595f60d3cd"
nailgun_size = 203910

[coursier]
repos = [
  ...
  "https://maven.pkg.github.com/soundtrackyourbrand/nailgun",
]
```

If it turns out looking good I'm thinking it could be published to Maven
Central and be more of a default replacement.

64 of 65 new or added lines in 3 files covered. (98.46%)

93261 of 100495 relevant lines covered (92.8%)

3.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.26
/src/python/pants/jvm/jdk_rules.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc