java-module

Gradle for Java 11 with Modules

雨燕双飞 提交于 2020-01-02 04:08:12
问题 I'm trying to run a sample JavaFX app on Mac OS. build.gradle apply plugin: 'java' apply plugin: 'application' repositories { mavenCentral() } dependencies { compile "org.openjfx:javafx-base:11" compile "org.openjfx:javafx-graphics:11" compile "org.openjfx:javafx-controls:11" } compileJava { doFirst { println "CLASSPATH IS $classpath.asPath" options.compilerArgs = [ '--module-path', classpath.asPath, '--add-modules', 'javafx.graphics' ] classpath = files() } } Java class package com.test;

How to suppress the “requires transitive directive for an automatic module” warning properly?

Deadly 提交于 2020-01-02 02:23:06
问题 After upgrading a Maven project to Java 9 and adding a module descriptor, javac complains about a transitive dependency for an automatic module: [WARNING] /.../src/main/java/module-info.java:[3,35] requires transitive directive for an automatic module An example module-info.java to reproduce the problem: module com.example.mymodule { exports com.example.mymodule.myexportedpackage; requires transitive com.google.common; } The meaning of this warning is completely clear, here are some related

How to suppress the “requires transitive directive for an automatic module” warning properly?

断了今生、忘了曾经 提交于 2020-01-02 02:23:02
问题 After upgrading a Maven project to Java 9 and adding a module descriptor, javac complains about a transitive dependency for an automatic module: [WARNING] /.../src/main/java/module-info.java:[3,35] requires transitive directive for an automatic module An example module-info.java to reproduce the problem: module com.example.mymodule { exports com.example.mymodule.myexportedpackage; requires transitive com.google.common; } The meaning of this warning is completely clear, here are some related

Groovy Java 9 modules support

情到浓时终转凉″ 提交于 2020-01-02 00:53:05
问题 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? 回答1: 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.

How to work with resources in Java 9 modules

心不动则不痛 提交于 2019-12-31 02:15:26
问题 I built a small (hello world style) java 9 project using gradle and the jigsaw plugin. For a junit test I tried to access some file as a resource, but classLoader.getResource(filename) is not able to locate the file. Usually you put the file as src/test/resources/foo.txt and access it as /foo.txt , but with Java 9 it looks like things changed and resources are (similar like classes) encapsulated in modules. Where exactly do I have to put the resource file for gradle to package it correctly?

idea: too many module declarations found

不羁的心 提交于 2019-12-30 18:07:06
问题 I want to create hello world java 9 application and start it in intellij idea. Now I have following structure: content of inner module-info.java: module my.module.Second { requires my.module.First; } content of outer module-info.java: module my.module.First { exports my.pack; } But idea complains about my project: Error:(1, 1) java: too many module declarations found I don't understand why it happens and what really wrong. So Question: My question is how to force idea to accept my hello world

Why do we need requires static in java-9 module system? [duplicate]

China☆狼群 提交于 2019-12-30 10:06:32
问题 This question already has answers here : What's the difference between requires and requires static in module declaration (2 answers) Does the Java 9 Module system support optional dependencies? (1 answer) Closed 8 months ago . I started to learn jigsaw java-9 feature and read some articles/video. I can't understand concept of optional dependencies( requires static ) quote from article: When a module needs to be compiled against types from another module but does not want to depend on it at

What is an open module in Java 9 and how to use it

强颜欢笑 提交于 2019-12-30 03:43:11
问题 What is the difference between module with open keyword before and without it? For instance: open module foo { } module foo { } 回答1: In order to provide reflective access to your module, Java 9 introduced open keyword. You can create open module by using open keyword in module declaration. An open module grants reflective access to all of it's packages to other modules. For example, if you want to use some framework, that heavily relies on reflection, such as Spring, Hibernate etc, you can

Self-Contained Applications, built in Java

耗尽温柔 提交于 2019-12-30 01:16:05
问题 I've watched a few online presentations that briefly mentioned self-contained applications in Java 9, but I have a question that I would like cleared up. With the new module system, you're now allowed to only include the minimum amount of code required to run your application. However, does the system that wishes to run the application still require the JRE, or is that something that can be included in the base module within the program? I suspect it's the latter, as the page (here) to

Java 11 Eclipse finds automatic module, Maven does not

大兔子大兔子 提交于 2019-12-25 02:59:07
问题 I'm attempting to upgrade a 15 year old Maven multimodule project to Java 11, and the module system that was introduced in Java 9. Since the project is built using Maven, all dependencies are pretty clear. First I want to do this using the automatic module names, in order not to also introduce upgraded artifacts (if not absolutely required). Eclipse is pretty helpful in this process, autocompleting the automatic module names in the module-info.java. For example: requires dom4j; But if I