You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This directory contains the `module-info.java` file for the Java Platform Module System (JPMS).
4
+
5
+
## Why is this in a separate directory?
6
+
7
+
The `module-info.java` file is kept separate from `src/main/java/` for the following reasons:
8
+
9
+
1.**Eclipse IDE Compatibility**: Eclipse has known issues with Java modules, particularly when the project uses older Java versions or has complex module configurations. Keeping `module-info.java` separate prevents Eclipse from attempting to process it during development.
10
+
11
+
2.**Build-Time Integration**: The module descriptor is added to the compilation during the Maven build process via the `build-helper-maven-plugin`, which adds this directory as a source folder only during the build.
12
+
13
+
3.**IDE Independence**: This approach allows developers to use Eclipse without module-related compilation errors while still producing proper modular JARs when building with Maven.
14
+
15
+
## How it works
16
+
17
+
The Maven build process:
18
+
1. Compiles all regular Java sources from `src/main/java/`
19
+
2. Adds `src/main/module-info/` as an additional source directory
20
+
3. Compiles `module-info.java`
21
+
4. Packages everything into a proper modular JAR
22
+
23
+
## For Developers
24
+
25
+
-**Eclipse users**: You don't need to worry about this file - Eclipse won't see it
26
+
-**IntelliJ users**: IntelliJ handles modules better and can work with this setup
27
+
-**Maven builds**: The module descriptor is automatically included in the final JAR
28
+
29
+
If you need to modify the module descriptor, edit `src/main/module-info/module-info.java` directly.
0 commit comments