Questions tagged [module-info]

Used for module-info.class related queries used for module declaration in Java since its Java 9 release. This would mostly be coupled with java-9 or above tag.

The State of the Module System defines module declarations as:

A module’s self-description is expressed in its module declaration, a new construct of the Java programming language.

The simplest possible module declaration merely specifies the name of its module:

module com.foo.bar { }

The source code for a module declaration is, by convention, placed in a file named module-info.java at the root of the module’s source-file hierarchy. The source files for the com.foo.bar module, e.g., might include:

module-info.java
com/foo/bar/alpha/AlphaFactory.java
com/foo/bar/alpha/Alpha.java
...

A module’s declaration does not include a version string, nor constraints upon the version strings of the modules upon which it depends. This is intentional: It is not a goal of the module system to solve the version-selection problem, which is best left to build tools and container applications.

Module declarations are part of the Java programming language, rather than a language or notation of their own, for several reasons

157 questions
2
votes
2 answers

module Directory or module file inside name should be same or not

Directory Structure . ├── out │   └── calc-module │   ├── com │   │   └── ngsharma │   │   └── ocp │   │   └── Calculator.class │   └── module-info.class └── src └── calculator ├── com │   └──…
Ng Sharma
  • 2,072
  • 8
  • 27
  • 49
2
votes
1 answer

module-info javadoc: @moduleGraph

The javadoc of the module-info of the JDK 11 modules use the tag @moduleGraph. I guess this is what generates the module graphs: https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/module-summary.html Is this a non-standard tag? I can't…
Puce
  • 37,247
  • 13
  • 80
  • 152
2
votes
1 answer

Module not found even though its there

I've got a slight issue running my Java Application (it works fine when I run it through Maven). I get the error: Error occurred during initialization of boot layer java.lang.module.FindException: Module moduleName not found The module is there…
mievvin
  • 55
  • 1
  • 7
2
votes
1 answer

Intellij: Java 11: export module: package not found {module not found}, module-info.java

I'm trying to create a simple modular programming application. My project consists of two modules- com.module.model com.module.util when I'm trying to export the module com.module.model in module-info.java. IntelliJ cannot find the package to…
Caffeine Coder
  • 948
  • 14
  • 17
2
votes
1 answer

Package is accessible from more than one module in JDK 11 Module system

We are making use of Zulu JDK 11 and we are facing issue The package com.sample.test is accessible from more than one module: test1.module, test2.sample. Below is the git url for sample project and screenshot for your…
Kiran
  • 167
  • 2
  • 15
2
votes
1 answer

WildFly Service Module Loader - ClassNotFound on jdk.incubator.http.HttpClient

I am using WildFly15 with JDK 10 to build an application with the new HTTP Client and when I declare the jdk.incubator.httpclient as the only and single requirement in my module it works fine. (I can't go to JDK11 because we need to run in…
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
2
votes
1 answer

Use java automatic module cdi.api with maven and java 9+

I want to use CDI functionality in a java module. I'd like my code to remain generic and do not depend on a particular implementation. I use Java 11 and Maven 3.6.0. For a simplicity, my goal is reduced to importing package javax.enterprise.context…
2
votes
2 answers

Eclipse m2e doesn't support Maven test-jar with JPMS modules

I have a project 'java11-core' that generates a test jar artifact to share with project 'java11-app'. These projects build fine with command line Maven, but within Eclipse, the classes shared in the test jar cannot be found. Version Info: Apache…
NaderNader
  • 1,038
  • 1
  • 11
  • 16
2
votes
0 answers

annotation processor not working since java9

I have some annotation processors generating source-files within a maven project. This worked as expected but I am trying to migrate to java9 and now they are not executed anymore, or so I think. The Annotation processor is registered via import…
Magnus Lutz
  • 558
  • 3
  • 12
2
votes
2 answers

Why is requires transitive limited to the modules that directly require the module containing it?

Let say there is module x that exports something. Then there is module a: module a { exports some.package.from.a requires transitive x; } Then there are 100 modules b that require a : module b1 { exports some.package.from.b1 requires…
2
votes
1 answer

java Runtime error with module logic: java.lang.NoClassDefFoundError: javax/xml/ws/Service

since i migrate to jdk9 i'm getting the following error at runtime: java.lang.NoClassDefFoundError: javax/xml/ws/Service I'm not getting compilation error but only runtime error. the module-info is the following: module CXFPExGenCaller { …
OPMendeavor
  • 430
  • 6
  • 14
2
votes
3 answers

Why un-moduled JAR can access non exposes packaged of a moduled JAR?

I'm playing around with Java 9 in intelliJ: I've created 4 modules (all modules depended on module1): module1: exports packages pkg1 and exports pkg2 to module 2. module2: requires module1 and able to access both packages module3: requires module1…
AntonKam
  • 163
  • 11
2
votes
2 answers

How to build java 9 dependencies from maven dependencies

Java9 has introduced a strong modularity similar to OSGI and Maven Dependecies. Is there a maven plugin able to build the java 9 dependencies inspecting maven dependencies? For example,…
giusy
  • 365
  • 2
  • 5
  • 17
2
votes
3 answers

Is there a issue for the folder/directory name to be module name in Java 9?

Quoting from this source, it mentions that The name of the directory containing a module’s sources should be equal to the name of the module, e.g. for de.consol.devday.service Is this a good recommendation consider that folder name is…
1
vote
1 answer

module-info - module not found: com.fasterxml.jackson.core

I am trying to create a module-info file for my application but getting some issues with the com.fasterxml.jackson.core module when trying to build the application: ...\src\main\java\module-info.java:5: error: module not found:…
Conor Egan
  • 518
  • 1
  • 3
  • 21