Move module-info.java to /src/main/java
See original GitHub issueTo build gson as a JPMS module, the module-info.java
file needs to be in src/main/java
, not in src/main/java/com.google.gson
.
I checked https://guides.gradle.org/building-java-9-modules/ for confirmation.
With that change, and with these changes in build.gradle, the JAR builds fine as a modular JAR.
sourceCompatibility = 9
targetCompatibility = 9
// sourceSets.main.java.exclude("**/module-info.java")
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Move module-info.java to /src/main/java #1315 - google/gson
To build gson as a JPMS module, the module-info.java file needs to be in src/main/java, not in src/main/java/com.google.gson.
Read more >Where to place module-info.java using Java 9? - Stack Overflow
To answer your specific questions: Place module declaration ( module-info.java ) into the project's source root directory (e.g. src/main/java ).
Read more >574831 – Computation of module name in Java launch ... - Bugs
The module-info was moved from src/main/jpms to src/main/java => it failed unless I create a new Launch configuration (not a copy). 3.
Read more >Java Modules - Jenkov.com
A Java module is a packaging mechanism that enables you to package a Java application or Java API as a separate Java module....
Read more >Chapter 14. The Java Module System - Modern Java in Action
xml files and the Maven directory project structure. The module descriptor ( module-info.java ) needs to be located in the src/main/java directory. Maven...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The solution is easy. Do not use Gson, or anything else from Google.
This was resolved almost 1 year ago yet there is still no release. Considering we’re on a stable Java 12 release and some running Java 14 pre-builds and modularity should have been completely adopted by Java 11, can we please at least get a release addressing this issue? Even if it’s a minor release, 2.8.5.1. For projects where automatic modules aren’t an option (jlink for instance), it’s an inconvenience.