java-module

Why won't the ServiceLoader load any implementations from another module?

心已入冬 提交于 2019-12-24 18:59:28
问题 I have a multi-module maven project which is making use of the JPMS features. The consumer module is not loading the implementations present in the provider module. Here's the maven project structure: ServiceLoaderExample ├── consumer ├── distribution ├── provider ├── service The interface TestService is defined in the "service" module. The implementation is TestServiceImpl which is defined in the "provider" module. And the main() method in the "consumer" module uses the ServiceLoader API to

JMH doesn't run inside a Java Module (Unable to find the resource: /META-INF/BenchmarkList)

烂漫一生 提交于 2019-12-24 10:18:15
问题 I took a project that uses maven-surefire-plugin (automated tests) to trigger JMH benchmarks and added module-info.java to it. Now, META-INF/BenchmarkList is no longer getting generated (in fact, the entire directory is missing) so I end up with the following error when launching the benchmarks: ERROR: Unable to find the resource: /META-INF/BenchmarkList I suspect that Java Modules is preventing the annotation processor from running properly, but I can't figure out how to fix it. Any ideas?

How to define qualified exports to unknown modules?

夙愿已清 提交于 2019-12-24 00:43:25
问题 I have a Maven project with two Maven modules A and B . A contains the following Java module definition: module A { exports internal.util to B; exports external.A; } B contains the following Java module definition: module B { requires A; exports external.B; } When I build the project, I get an error: [WARNING] module-info.java:[16,106] module not found: B Module B exists but because Module A is compiled before B and does not depend on it, the compiler has no way of knowing that. Because I

Patching module raises module not found error

女生的网名这么多〃 提交于 2019-12-23 09:33:13
问题 I use jdk 11 and try to understand --patch-module option for java compiler. Here is the simple module I have: mdl-platform | | |___com.test.mdl.platform | | | |___ ... | | | |___Patch.java | |___module-info.java module-info.java : module com.test.mdl.plarform { exports com.test.mdl.platform; } Patch.java : public class Patch { } I have Patch.java file and wanted to patch the module with it. I tried: I. $ javac --patch-module com.test.mdl.platform=mdl-plarform/src/main/java/ \ mdl-plarform/src

Can one Java module export a package whose name is a subpackage of a package from another module? [duplicate]

别来无恙 提交于 2019-12-22 18:49:13
问题 This question already has an answer here : Java 9 sub-packages split across modules (1 answer) Closed 11 months ago . So I know that, in Java 9 modules (Project Jigsaw), split packages are not allowed. That is, the following modules couldn't both export a package with the same name and also be used at the same time at run time: Module 1 module com.example.foo { exports com.example.foo; } Module 2 module com.example.foo { exports com.example.foo; } Not allowed (or, at least, they can't run at

java 9 unnamed module reads package [X] from both … while debugging (with IntelliJ)

主宰稳场 提交于 2019-12-22 08:10:13
问题 In my project I have a package that uses several 3rd party libraries. Let's have a look at the dependency tree: [INFO] +- commons-logging:commons-logging:jar:1.2:compile [INFO] +- org.apache.directory.studio:org.apache.commons.collections:jar:3.2.1:compile [INFO] | \- commons-collections:commons-collections:jar:3.2.2:compile [INFO] +- xerces:xercesImpl:jar:2.11.0:compile [INFO] | \- xml-apis:xml-apis:jar:1.4.01:compile [INFO] +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.2.2:compile [INFO] | +

Java 9 migration issue - package com.mymodule is declared in unnamed module , module 'newmodule' does not read it

荒凉一梦 提交于 2019-12-22 07:59:13
问题 I have created a multimodule project with the following structure myproject |- mymodule |- src |- main |- java |- com |- mymodule |- Util.java |-newmodule |-src |-main |-java |-com |-newmodule |- Main.java |-module-info.java Now i want to use Util.java which is a non modularized code in a modularized module newmodule. i have declared following in newmodule module newmodule { requires mymodule; } Project is compiling fine, but Intellij is showing module not found and package com.mymodule is

Java 9 migration issue - package com.mymodule is declared in unnamed module , module 'newmodule' does not read it

倖福魔咒の 提交于 2019-12-22 07:59:13
问题 I have created a multimodule project with the following structure myproject |- mymodule |- src |- main |- java |- com |- mymodule |- Util.java |-newmodule |-src |-main |-java |-com |-newmodule |- Main.java |-module-info.java Now i want to use Util.java which is a non modularized code in a modularized module newmodule. i have declared following in newmodule module newmodule { requires mymodule; } Project is compiling fine, but Intellij is showing module not found and package com.mymodule is

How do I include a java 9 module at runtime?

我是研究僧i 提交于 2019-12-22 07:02:47
问题 I have a server kit that I'm trying to test on the java9 JDK (found here, I'm using the 64-bit Linux version), however I'm encountering the following error shortly after startup: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:533) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:186

Java Beans Introspector requires desktop module

巧了我就是萌 提交于 2019-12-22 05:33:10
问题 I'm investigating using Jigsaw to reduce the footprint of a microservice. One of the last dependencies I had to find was java.beans.Introspector. Imagine my surprise when I discovered I needed to bring in the whole module java.desktop which contains all sorts of irrelevant stuff like awt, applets, swing etc. This seems crazy to me, surely bean introspection should be a part of the fundamental language and not related to UI functionality. I think the dependency comes from the embedded Tomcat