ymnk / jsch-agent-proxy

Other
70 stars 41 forks source link

Excluding com.jcraft.jsch.agentproxy from exported packages #23

Closed demobox closed 9 years ago

demobox commented 9 years ago

Also ensuring it's no longer transitively included in the JAR. This means OSGi users will also need to import the jsch.agentproxy.core bundle, which should be providing the core files.

That, in turn, avoids a "uses constraint violation" when trying to load both the usocket-nc and usocket-jna bundles if the core bundle is not being imported (which is currently not necessary, since connector-factory exports the core package too).

demobox commented 9 years ago

Currently, the situation is as follows:

java.lang.Exception: Could not start bundle mvn:com.jcraft/jsch.agentproxy.usocket-jna/0.0.8 in feature(s) ...: Uses constraint violation. Unable to resolve bundle revision com.jcraft.jsch.agentproxy.usocket-jna [95.0] because it exports package 'com.jcraft.jsch.agentproxy.usocket' and is also exposed to it from bundle revision com.jcraft.jsch.agentproxy.usocket-nc [92.0] via the following dependency chain:

  com.jcraft.jsch.agentproxy.usocket-jna [95.0]
    import: (&(osgi.wiring.package=com.jcraft.jsch.agentproxy)(version>=0.0.0)(!(version>=1.0.0)))
     |
    export: osgi.wiring.package=com.jcraft.jsch.agentproxy; uses:=com.jcraft.jsch.agentproxy.usocket
  com.jcraft.jsch.agentproxy.connector-factory [91.0]
    import: (&(osgi.wiring.package=com.jcraft.jsch.agentproxy.usocket)(version>=0.0.0)(!(version>=1.0.0)))
     |
    export: osgi.wiring.package=com.jcraft.jsch.agentproxy.usocket
  com.jcraft.jsch.agentproxy.usocket-nc [92.0]

This PR aims to address these points by ensuring that connector-factory no longer packages or exports the core classes. This means that OSGi users will need to import the core bundle specifically, so is a breaking change. However, any users that wanted to import connector-factory with all its deps already needed to import the core bundle to avoid the uses constraint violation, so the set of affected users is hopefully small.

An alternative approach that doesn't require any changes to the bundle-plugin config would be to move ConnectorFactory to its own package, e.g. c.j.j.a.connector.factory. However, this would be a breaking change for all users, not just a subset of OSGi users.

demobox commented 9 years ago

@ymnk Quick ping on this..?

ymnk commented 9 years ago

The commit 2d59e3b93dc400f2145b787d667444d8fe3201e3 has excluded those classes.

demobox commented 9 years ago

The commit 2d59e3b has excluded those classes.

@ymnk Great, thanks!