Comments (11)
Please post the contents of /Users/garydgregory/git/commons-beanutils-1/target/moditect/commons.beanutils/versions/9/module-info.java
from moditect.
That file is generated by the build when you run mvn
(notice that it's in the target directory):
cat target/moditect/commons.beanutils/versions/9/module-info.java
says:
module commons.beanutils {
requires commons.logging;
requires transitive commons.collections;
requires transitive java.desktop;
requires transitive java.sql;
exports org.apache.commons.beanutils;
exports org.apache.commons.beanutils.converters;
exports org.apache.commons.beanutils.expression;
exports org.apache.commons.beanutils.locale;
exports org.apache.commons.beanutils.locale.converters;
}
from moditect.
Indeed. This is the file that javaparser is chocking on at the moment.
from moditect.
Hm, ok, now what?
from moditect.
There's something odd with the modiTect setup. As far as I can tell from commons-parent:69
the module name is defined by an expresion ${commons.module.name}
Which should make that expression evaluate to org.apache.commons.commons-beanutils
and used as input for modiTect. However, the generated module descriptor uses commons.beanutils
instead. Now, java parser chokes because it found a "-" character, which so happens to be the hyphen in commons-beanutils
.
Explicitly defining a value for commons.module.name
such as
<commons.module.name>org.apache.commons.commons.beanutils</commons.module.name>
Makes the build work. So, now the question is: why is the the generated module name common.beanutils
and not org.apache.commons.commons-beanutils
?
Update: as far as I recall "-" is an invalid character for a JPMS module.
from moditect.
Running the build with -X
shows the inputs sent to modiTect
[DEBUG] Loading mojo org.moditect:moditect-maven-plugin:1.2.1.Final:add-module-info from plugin realm ClassRealm[plugin>org.moditect:moditect-maven-plugin:1.2.1.Final, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@3d71d552]
[DEBUG] Configuring mojo execution 'org.moditect:moditect-maven-plugin:1.2.1.Final:add-module-info:add-module-infos' with basic configurator -->
[DEBUG] (f) artifactId = commons-beanutils
[DEBUG] (f) buildDirectory = /tmp/commons-beanutils/target
[DEBUG] (f) failOnWarning = false
[DEBUG] (f) jdepsExtraArgs = [--multi-release=9]
[DEBUG] (f) jvmVersion = 9
[DEBUG] (s) name = org.apache.commons.commons-beanutils
[DEBUG] (s) addServiceUses = true
[DEBUG] (s) moduleInfo = ModuleInfoConfiguration [requires=*;, exports=*;, opens=!*;, opensResources=null, uses=null, provides=null, name=org.apache.commons.commons-beanutils, addServiceUses=true, open=false]
[DEBUG] (f) module = MainModuleConfiguration [ moduleInfo=ModuleInfoConfiguration [requires=*;, exports=*;, opens=!*;, opensResources=null, uses=null, provides=null, name=org.apache.commons.commons-beanutils, addServiceUses=true, open=false], moduleInfoFile=null, moduleInfoSource=null, mainClass=null]
[DEBUG] (f) outputDirectory = /tmp/commons-beanutils/target
[DEBUG] (f) outputTimestamp = 2024-01-01T00:00:00Z
[DEBUG] (f) overwriteExistingFiles = true
[DEBUG] (f) project = MavenProject: commons-beanutils:commons-beanutils:1.9.5 @ /tmp/commons-beanutils/pom.xml
[DEBUG] (f) remoteRepos = [apache.snapshots (https://repository.apache.org/snapshots, default, snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] (f) repoSession = org.eclipse.aether.DefaultRepositorySystemSession@10fcc44b
[DEBUG] (f) skip = false
[DEBUG] (f) version = 1.9.5
[DEBUG] (f) workingDirectory = /tmp/commons-beanutils/target/moditect
[DEBUG] -- end configuration --
Clearly showing the problematic input as
[DEBUG] (s) name = org.apache.commons.commons-beanutils
from moditect.
Aaand I'm an idiot. The generated module-info.java
file was created using jdeps
which takes the module name from the filename. So it's OK. The actual generated module-info.class
looks like this
$ jarviz module descriptor --file target/commons-beanutils-1.9.5-SNAPSHOT.jar
subject: commons-beanutils-1.9.5-SNAPSHOT.jar
name: org.apache.commons.commons.beanutils
version: 1.9.5-SNAPSHOT
open: false
automatic: false
exports:
org.apache.commons.beanutils
org.apache.commons.beanutils.converters
org.apache.commons.beanutils.expression
org.apache.commons.beanutils.locale
org.apache.commons.beanutils.locale.converters
requires:
commons.collections
commons.logging
java.base mandated
java.desktop
java.sql
from moditect.
Ah! This makes sense now, we must have commons.module.name
defined. We must give Moditect a reasonable value, and in this case, the one we built by default was bad. TY!
from moditect.
Here's the thing, modiTect could either:
- Warn if the proposed module name is invalid and bail out
- Transform the proposed module name to a valid one (when possible), bailing out if unsuccessful
The current error is accurate but cryptic.
@gunnarmorling WDYT?
from moditect.
I don't think a hidden transformation is OK. Especially if I can't turn it off. I don't want to be in the position of publishing a surprising and unintentionally wrong name.
from moditect.
A better error message is welcome of course.
from moditect.
Related Issues (20)
- jdepsExtraArgs gotcha HOT 2
- Support or document how to generate module info for a Maven plugin HOT 4
- Support for new Compression vars HOT 6
- add-module-info no longer allows replacing the existing module-info in a jar HOT 1
- NullPointerException during create-runtime-image HOT 8
- Update Maven deployment strategy HOT 1
- Ability to replace dependencies HOT 1
- `add-module-info` of moditect-maven-plugin fails for multi-module projects, Shade plugin with "xxx-[version].jar is already modular" HOT 4
- Generated JAR file depends on default time zone HOT 10
- [BUILD] Use ${maven.multiModuleProjectDirectory} instead of directory-maven-plugin HOT 2
- Java 22 support HOT 1
- [BUILD] update build to require Java 11+ for building HOT 23
- Contributing CDI SE Example HOT 2
- problem about .\module-info.class and META-INF\services\9 HOT 9
- Update license and maven configuration HOT 1
- NPE in create-runtime-image if jar not created HOT 2
- 1.2.0.Final break builds where 1.1.0 works (Apache Commons IO): `add-module-info failed: Couldn't copy JAR file` HOT 9
- Cannot run verify twice without clean - build complains about split packages HOT 4
- Creating invalid modules HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moditect.