1 year ago

#388336

test-img

cmutex

How do I use a legacy jar file with an automatic-module-name in Java?

Assume that a legacy jar file x.jar has an automatic-module-name com.foo.mymodule defined for it in its manifest file. Also, I want to use it in my application that uses modules.

The below is how I tried to use it (using gradle).

// build.gradle
dependencies {
  implementation fileTree(dir: 'path/to/dir/containing_x_jar', include: '*.jar')
}

// module-info.java
module org.my.app {
   requires com.foo.mymodule;
  //...
}

Unfortunately, when I build it I get: error: module not found: com.foo.mymodule. I also tried to make use of the extra-module-info plugin from https://github.com/jjohannes/extra-java-module-info, but still I'm not able to build it successfully. Any ideas?

Thanks

java

gradle

build.gradle

java-module

0 Answers

Your Answer

Accepted video resources