In Jackson 2.x we use Moditect plugin to add module-info.class, instead of relying on javac. This because build is done using JDK 8 which cannot handle module-info.java.

But with Jackson 3.0 using JDK 17 or above we can and should convert.

NOTE: all modules should do this, except for jackson-annotations which remains JDK 8 built for now.

Comment From: pjfanning

I think module-info.class needs to be put in META-INF/versions/11 (or 9). I'm not sure if fb5ad1b8071a948a92b37904dd5838b4b84aba0a would do that.

Comment From: cowtowncoder

I think module-info.class needs to be put in META-INF/versions/11 (or 9). I'm not sure if fb5ad1b would do that.

Not sure why -- minimum JDK for master/3.0 is JDK 17. Do you have a link to something that explains possible reasons to do so? (docs I saw just talked about src/main/java/ (and src/test/java for test version)

But either way I think it's shade plugin that is somehow filtering/not-copying module-info.class, regardless of where it needs to go.

Comment From: pjfanning

I think module-info.class needs to be put in META-INF/versions/11 (or 9). I'm not sure if fb5ad1b would do that.

Not sure why -- minimum JDK for master/3.0 is JDK 17. Do you have a link to something that explains possible reasons to do so? (docs I saw just talked about src/main/java/ (and src/test/java for test version)

But either way I think it's shade plugin that is somehow filtering/not-copying module-info.class, regardless of where it needs to go.

You are probably right - that the module-info.class only needs to be in META-INF/versions when you still support Java 8.

Comment From: cowtowncoder

I think we should not put it under META-INF/versions/ any longer for 3.0.0 -- but not sure how to prevent Moditect from doing that...

Comment From: pjfanning

@cowtowncoder I asked a GenAI tool and it agrees that module-info.class should be in jar root dir if we don't support Java 8 any more. The META-INF/versions location for module-info.class is only needed if we need to support Java 8 users.

Comment From: cowtowncoder

Alas, after trying to change this, I suspect we actually still need it, unfortunately... because of shading of different versions of "FastDoubleParser" (I also consulted GenAI which showed how to change things, but no change in inclusion).

Comment From: pjfanning

Alas, after trying to change this, I suspect we actually still need it, unfortunately... because of shading of different versions of "FastDoubleParser" (I also consulted GenAI which showed how to change things, but no change in inclusion).

We still need META-INF/versions for the FastDoubleParser versioned classes but module-info.class should move to root.

Comment From: cowtowncoder

Right; that seems legal. I suspect Moditect plug-in is just being cautious, or not considering this use case.

Still, none of the changes I attempted moved module-info.class to root. Maybe someone can figure it out.

Comment From: jafarre-bi

I'm sure you have already tried this, but just in case, from Moditect readme:

The optional jvmVersion element allows to define which JVM version the module descriptor should target (leveraging the concept of multi-release JARs). When defined, the module descriptor will be put into META-INF/versions/${jvmVersion}. The value must be 9 or greater. The special value base (the default) can be used to add the descriptor to the root of the final JAR.

So, apparently, omitting jvmVersion or specifying jvmVersion=base should do the trick.

Comment From: cowtowncoder

@jafarre-bi I had indeed tried out removing jvmVersion and this will not change the result unfortunately.

But I have NOT tried "base"... will do so now.

My suspicion tho is that since we do need Multi-Release jar (for per-JDK FastDoubleParser optimized classes), Moditect may not put module-info.class in root regardless. We'll see :)

Comment From: cowtowncoder

Alas: while use of "base" does change things, now module-info.class gets actually dropped. This due to configuration of maven-jar-plugin:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <Multi-Release>true</Multi-Release>
            </manifestEntries>
          </archive>
          <!-- 10-Jan-2025, tatu: [core#1380] Kludgerus Maximums... must actually
             remove `module-info.class` just so Moditect can add it in place
             where shade plugin will not filter it out. Oy vey.
            -->
          <excludes>
            <exclude>module-info.class</exclude>
          </excludes>
        </configuration>
      </plugin>

now: removing excludes gets us another previously seen failure:

[ERROR] Failed to execute goal org.moditect:moditect-maven-plugin:1.3.0.Final:add-module-info (add-module-infos) on project jackson-core: File jackson-core-3.0.0-rc10-SNAPSHOT.jar is already modular -> [Help 1]

so not quite sure where to go from here.

Comment From: cowtowncoder

As the last thing, tried removing more plug-ins, including Moditect. But I think it's maven-shade-plugin that simply removes root-level module-info.class.

At any rate, if anyone wants to try to solve this, great; I cannot figure it out. :) (but we shouldn't really have to, TBH, either).