Skip to content

JGIT SSH commit signing / NetBinox removal / JNA as OSGI bundle#9483

Open
matthiasblaesing wants to merge 6 commits into
apache:masterfrom
matthiasblaesing:jgit-signing-alt
Open

JGIT SSH commit signing / NetBinox removal / JNA as OSGI bundle#9483
matthiasblaesing wants to merge 6 commits into
apache:masterfrom
matthiasblaesing:jgit-signing-alt

Conversation

@matthiasblaesing

Copy link
Copy Markdown
Contributor

The primary motivation of this PR is moving the ssh support for JGIT from JSch to the Apache Mina based implementation. According to the JGIT project support for JSch is deprecated and there are no plans to move from the unmaintained version com.jcraft:jsch to com.github.mwiede:jsch.

The move to the Mina based client is also required to enable SSH signing of commits.

As preparation NetBinox, the one of the two OSGI implementations NetBeans currently offers, is dropped as it is essentially unmaintained.

A second necessary preparation is to make JNA available as an OSGI bundle of the correct name. JNA was available to the OSGI environment via package imports, but the agent integration code of jgit declares a bundle requirement and thus needs the correct name. This is accomplished by providing an alias/shim module that reexports the original packages with the correct name in addition to the NetBeans module name.

Closes: #9471
Closes: #7572

@matthiasblaesing matthiasblaesing added DO NOT squash git [ci] enable versioning job ci:all-tests [ci] enable all tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Jul 2, 2026
@matthiasblaesing matthiasblaesing added this to the NB31 milestone Jul 2, 2026
@matthiasblaesing

Copy link
Copy Markdown
Contributor Author

This is an alternative approach to #9472

Netbinox is a patched version of Equinox (the Eclipse OSGI runtime
conainer). The patch is bases on a Equinox version from 2014. The patch
was evolved to allow "Import-Package" declaration for JDK packages if
they are declared optional. This works as long as the imports are
declared optional. This is not the case for a growing number of
libraries.

NetBeans already carries an up-to-date OSGI container (Apache Felix), so
use that and drop the custom dependency.

In the wake of this the following modules were removed too:

  - o.eclipse.core.contenttype
  - o.eclipse.core.jobs
  - o.eclipse.core.net
  - o.eclipse.core.runtime
  - o.eclipse.core.runtime.compatibility.auth
  - o.eclipse.equinox.app
  - o.eclipse.equinox.common
  - o.eclipse.equinox.preferences
  - o.eclipse.equinox.registry
  - o.eclipse.equinox.security

It is assumed that equinox was added to be able to run eclise modules,
which in turn were required for Mylin (Bugtracking integration). The
latter was dropped, so the dependencies should be removed to reduce the
dependency footprint.
…m -> o.n.libs.jna.platform

Netigso (the NetBeans OSGI Integration layer) makes NetBeans modules
available to the OSGI environment. For JNA this works as long as the
dependent modules use the "Import-Package" header. It fails if the JNA
bundle is imported via "Require-Bundle". The reason for this is the
mismatch between the upstream bundle name and the NetBeans module name.

The alias/shim modules reexport the JNA modules with the upstream bundle
name.

@lkishalmi lkishalmi 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.

I read these through. For me it makes sense.
Thank you!

@matthiasblaesing

Copy link
Copy Markdown
Contributor Author

Updated in place:

The jgit signing commit was missing the net.i2p.crypto.eddsa library, which is used by Apache Mina to provide support for ed25519 curve support.

@matthiasblaesing matthiasblaesing force-pushed the jgit-signing-alt branch 2 times, most recently from fd7914e to 0e1df63 Compare July 7, 2026 19:51
@matthiasblaesing

Copy link
Copy Markdown
Contributor Author

Updated in place:

net.i2p.crypto.eddsa was dropped again. Bouncy castle support ed25519 by itself it is just Mina trying to load a non-functional security provider and not guarding that. As a work around the git module not disables the security provider from Mina that tries to load net.i2p.crypto.eddsa.

Mina explicitly states (https://github.com/apache/mina-sshd/blob/master/docs/dependencies.md#ed25519-java, hightlights added):

ed25519-java

Can optionally be provided to support ssh-ed25519 keys and ed25519-sha-512 signatures where Bouncy Castle is not suitable. Note: use of this dependency is not recommended, but it can be added as an explicit dependency in order to provide Ed25519 support as follows:

This adds the required dependencies and switches the jgit ssh
integration from JSch to Apache Mina.

This adds four new dependencies:

- Apache MINA SSH Client implementation
  (org.apache.sshd:sshd-osgi and org.apache.sshd:sshd-sftp)
- JGIT ssh client implementation using Apache MINA (inkl. the
  ssh-agent integration)

Adjustments to the implementation:

- The jgit integration for mina does not query the credential provider
  for a passphrase when opening the identity file, but instead uses a
  password callback (existing Credentialsprovider was adjusted to
  tollerate this)
- The NetBeans ssh connection settings allow to choose between
  username/password and key authentication. There is no fallback between
  the two. The concept of a custom SshSessionFactory was transfered from
  the jsch implementation and reimplemented on top of the mina
  integration.
The patching was in place to enable loading commons-lang3 into the
NetBinox container (patched equinox). With NetBinox dropped in favor of
Apache Felix, this can be now removed.
@matthiasblaesing matthiasblaesing added the do not merge Don't merge this PR, it is not ready or just demonstration purposes. label Jul 10, 2026
@matthiasblaesing

Copy link
Copy Markdown
Contributor Author

The removal of NetBinox causes problem is feature-on-demand. I'll have to investigate. With the next release approaching I don't plan to merge this for 31.

@jtulach

jtulach commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Please separate the Netbinox removal effort into its own PR.

  • JGIT SSH commit signing
  • NetBinox removal
  • JNA as OSGI bundle

I don't understand why the Netbinox removal is part of such a Jumbo PR? A major change like that deserves its own PR, I believe! I am not interested in commenting JGit SSH commit signing change, but I'd like to add some notes about Netbinox - which I still consider the major success of NetBeans in the 2010-2015 "Oracle" era.

As preparation Netbinox is dropped as it is essentially unmaintained.

Is there any other problem with Netbinox except it is essentially unmaintained (just like a majority of NetBeans Platform code)?

(Netbinox is) the one of the two OSGI implementations

It is not just "one of two". It is the faster one. It is also the one necessary for running Mylyn the "OSGi way". It is the base for integration with JDeveloper.

Maybe such "cut offs" are necessary given the manpower left, but after enumerating them, I shall probably ask: What would I have to do to create a perception of Netbinox being maintained?

@matthiasblaesing

Copy link
Copy Markdown
Contributor Author

@jtulach for me NetBinox is unmaintained because:

  • building it requires to checkout a repository, that only exists for historical reasons
  • the patch can't be applied to current versions of equinox
  • the patch for equinox already had to be extended so that it accepts Import-Package statements for JDK classes. This allows bouncy castle to load.
  • the patch for the previous case is not enough as it only works if the imports are declared optional, for the jgit jars this is not the case anymore

For the "why this giantic PR": Because this is the usecase that was the final straw. The removal makes only sense when you see the context.

The equinox is a mylyn requirement does not hold anymore as mylyn on NetBeans is history. Even if it would be, I'd like to see tests on current OSGI runtimes with up-to-date mylyn dependencies that verify that mylyn is equinox only.

Feature on Demand scans the feature list and uses the URL for the
feature to identify the correct feature. URL uses the registered
Handler to implement #equals and #hashCode. When run with NetBinox
both the layers and the FeatureInfo yield URLs using the
JarClassLoader. When run with Felix as OSGI runtime the layers report
URLHandlersStreamHandlerProxy.

Instead of changing the URL logic, use the URI to find a valid
FeatureInfo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:all-tests [ci] enable all tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) do not merge Don't merge this PR, it is not ready or just demonstration purposes. DO NOT squash git [ci] enable versioning job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check if we can switch from JSch to Apache Mina as JGit backend Unable to verify plugins, then freezes

3 participants