Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues using bundle plugin with Java modules #5855

Closed
headius opened this issue Sep 1, 2019 · 4 comments · Fixed by #5860
Closed

Issues using bundle plugin with Java modules #5855

headius opened this issue Sep 1, 2019 · 4 comments · Fixed by #5860
Milestone

Comments

@headius
Copy link
Member

@headius headius commented Sep 1, 2019

I've been trying to figure out how to get the jruby-core and jruby-complete jar files to include Java module information, but so far I'm stuck dealing with the Apache Felix bundle plugin's weak support for filtering files.

@mkristian I need help here!

I want to get at LEAST Automatic-Module-Name in the manifests for all forms of jar files we export, a la jruby-core.jar should be "org.jruby.core", jruby-complete.jar should be "org.jruby.complete" and the jruby.jar in the dist should be "org.jruby.dist". Only this last one works currently.

The core jar refuses to take the Automatic-Module-Name manifest entry no matter what I do. I've tried modifying various places in core/pom.rb and in maven/jruby/pom.rb and it never picks it up.

The situation with jruby-complete is even worse. Because it relies on the maven-bundle-plugin (OSGi bundler) it pulls in the module-info.class files from joni, jcodings, and invokebinder. This last one "wins" because it's later in dependencies and there's no way to omit this file using the bundle plugin.

I did manage to get Automatic-Module-Name to be in the manifest by adding it to the "archive" subsection of the bundle plugin config, but because module-info.class is present this is ignored. The jar ends up looking like it's just an invokebinder module.

Hints online are sparse. The best recommendation I found was to ditch the bundle plugin and go back to just a shade plugin, which allows fine-grained filtering and renaming we want.

I'm not sure how to proceed here, but it's really a mess that our published jruby-complete jar advertises itself as the invokebinder module.

@headius headius added this to the JRuby 9.2.9.0 milestone Sep 1, 2019
@headius

This comment has been minimized.

Copy link
Member Author

@headius headius commented Sep 1, 2019

Getting Automatic-Module-Name into the jruby-complete jar's manifest:

diff --git a/maven/jruby-complete/pom.rb b/maven/jruby-complete/pom.rb
index a89e9fbd2b..1c66dcb1e9 100644
--- a/maven/jruby-complete/pom.rb
+++ b/maven/jruby-complete/pom.rb
@@ -38,6 +38,9 @@ project 'JRuby Complete' do
           :archive => {
             :manifest => {
               :mainClass => 'org.jruby.Main'
+            },
+            manifestEntries: {
+                'Automatic-Module-Name' => 'org.jruby.complete'
             }
           },
           :instructions => {

One attempt to get it in jruby-core:

diff --git a/core/pom.rb b/core/pom.rb
index 7f15882ab7..767a04826c 100644
--- a/core/pom.rb
+++ b/core/pom.rb
@@ -242,7 +242,13 @@ project 'JRuby Core' do
           'additionalClasspathElements' => [ '${basedir}/src/test/ruby' ] )
 
   plugin(:jar,
-         archive: {manifestEntries: {'Automatic-Module-Name' => 'org.jruby'}})
+         archive: {
+             manifestEntries: {
+                 'Automatic-Module-Name' => 'org.jruby.core',
+                 'Main-Class' => 'org.jruby.Main'
+             }
+         },
+   )
 
   build do
     default_goal 'package'
@mkristian

This comment has been minimized.

Copy link
Member

@mkristian mkristian commented Sep 4, 2019

@headius so jruby-complete.jar it would be enough if we are able to get rid of modue-info.class from the jar - right ?

@headius

This comment has been minimized.

Copy link
Member Author

@headius headius commented Sep 4, 2019

@mkristian Yes if we could strip that file then the Automatic-Module-Name would take effect.

@headius

This comment has been minimized.

Copy link
Member Author

@headius headius commented Sep 4, 2019

I still have been unable to get the jruby-core jar to have a proper Automatic-Module-Name though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.