jigsaw

Java Beans Introspector requires desktop module

北城以北 提交于 2019-12-05 07:16:44
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 from Spring Boot so it's not something I can modify myself. The Question: Are modules the finest

Groovy Java 9 modules support

一个人想着一个人 提交于 2019-12-05 00:22:58
I've spent some time to migrate my project written in Groovy to Java 10. Now it's possible to compile and run it. But still it doesn't use any benefits of Java 9 modularity. Googling about Groovy and Java 9 modules gives almost nothing. So is it possible to migrate Groovy project to use JDK 10 with Project Jigsaw modules? Well, after a few days of experiments I come up with the answer - yes, it is possible to use Groovy with Project Jigsaw modules. But it needs some additional effort. Let's say we have following file structure: ├── build ├── jigsaw │ └── module │ └── test │ └── Application

JaCoCo and MR Jars

安稳与你 提交于 2019-12-04 13:23:23
There is an issue with JaCoCo and the MultiRelease JAR files . Since the same class name exist on two places, JaCoCo complains: Caused by: java.lang.IllegalStateException: Can't add different class with same name: jodd/core/JavaBridge at org.jacoco.core.analysis.CoverageBuilder.visitCoverage(CoverageBuilder.java:107) at org.jacoco.core.analysis.Analyzer$1.visitEnd(Analyzer.java:96) How we can tell JaCoCo (in Gradle) to skip the classes from META-INF path? OR to behave like it should (use correct class and ignoring other versions), depending on JVM version? igr As explained by @nullpointer,

“Essential” (Jigsawed) Java 9 JRE without modularized code

久未见 提交于 2019-12-04 10:09:12
We have a Java application that does not use AWT/Swing/JavaFX and works fine with a private bundled JRE 8. JRE 9 is significantly larger than JRE 8 but we want to let the users try our application with JRE 9. We don't yet want to modularize our code or the jars (to keep compatibility with Java 8). How to create an "essential" (= stripped down to the minimal required parts), private JRE 9 that could be bundled with that Java application? It is possible to create custom runtime-images of the JRE without having converted the application itself to Java 9 modules. First, we need to find out what

Why did Java 9 introduce the JMOD file format?

∥☆過路亽.° 提交于 2019-12-04 07:47:55
问题 Java 9 has three ways to package compiled code in files: JAR JMOD JIMAGE JIMAGE is optimized for speed and space and used by the JVM at runtime so it makes sense why JIMAGE was introduced. JIMAGE files are not supposed to be published to maven repos or used at compile or link time. The docs claim that JMOD can store native code and other things that can't be stored by JAR files and that developers can make and distribute their own JMOD files. The JDK ships with jmods/ directory containing all

How can I handle split packages in automatic modules?

ぐ巨炮叔叔 提交于 2019-12-04 03:21:20
I am currently testing to migrate an existing application to Jigsaw Modules. One of my modules uses ElasticSearch along with its Groovy Plugin. org.elasticsearch:elasticsearch org.elasticsearch.module:lang-groovy Unfortunately, they share a split package, so mvn install gives me: x reads package org.elasticsearch.script.groovy from both lang.groovy and elasticsearch once for each required module in the descriptor, where x is the name of each module. I assume that a newer elasticsearch version will have eliminated the split package by the time Java 9 is final, but is there generally a way to

Exporting a package from system module is not allowed with --release

天涯浪子 提交于 2019-12-04 02:23:09
I have the following program: module-info.java module a { } Main.java public class Main { public static void main(String[] args) { System.out.println(sun.nio.ByteBuffered.class); } } This program successfully compiles with the --add-exports option: > javac --add-exports java.base/sun.nio=a module-info.java Main.java However, when I add the --release argument, it fails: > javac --add-exports java.base/sun.nio=a --release 9 module-info.java Main.java error: exporting a package from system module java.base is not allowed with --release 1 error Basically, these two commands are equivalent. So why

Is it possible to use dependencies without module-info.class in a Java 9 module

喜你入骨 提交于 2019-12-04 01:15:36
I created two small projects de.app1 and de.app2 , where App from de.app1 uses Test from de.app2 . ├── de.app1 │ ├── de │ │ └── app │ │ └── App.java │ └── module-info.java └── de.app2 └── de └── test └── Test.java module-info.java in the first project just contains module de.app1 {} I compiled the second project and created a jar file: javac de/test/Test.java jar cf app2.jar de/test/Test.class and then tried to compile the first project like this: javac -cp ../de.app2/app2.jar de/app/App.java module-info.java which failed because Test could not be found. When I compile the project without

What do I need to build JDK 9 project with non-modular dependencies using Maven

对着背影说爱祢 提交于 2019-12-04 01:06:37
I have a simple Java 9 SE project with one dependency on a non-modularized project (chose Weld SE for this example) and I am trying to build it with Maven ( clean install ).In order for Java 9 to kick in, I have added module-info.java . Originally, this file only contained module name and had no requires formulas. Please bear in mind that my sole dependency is NOT a modular project, therefore I presumed Maven will put in the classpath (not module-path) and hence it will end up in the unnamed module as described in State of the modular system . Now, my Maven version is 3.3.9 and I am aware that

Java 9 Modules and JUnit 4

北城余情 提交于 2019-12-03 15:34:06
Eclipse oxygen; windows 7; JDK 9 final from 9, 21; JUnit 4.12 and an existing application. As starting point the application can be compiled, executed and all JUnit Tests shows green. Now we use eclipse to generate the file module-info.java. The outcome looks like: module ch.commcity.topsort { exports ch.commcity.topsort; requires junit; } But with the error: junit cannot be resolved to module. The question is: How to tell the file that junit does not define any module and it should be run in compatibility mode? How to tell the file that junit does not define any module and it should be run in