Comments (11)
Hmmh. That would be nice... I learned it by trial and error, but not sure I ever figured out a reliable mechanism even. Moditect plug-in has (at least) 2 targets; one that is enabled (use existing module-info.java, bake it in) is easy, but one used for first-time generation is trickier.
I think I added plugin settings at some point, under specific profile (so it needs to be invoked by setting maven profile on command line). This is done in pom jackson-base
(which is actually in jackson-bom
repo):
<profiles>
<profile>
<id>moditect</id>
<properties>
<!-- Not only do we need JDK 9+, must target later JDK too -->
<java.version>1.9</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-module-info</id>
<phase>generate-sources</phase>
<goals>
<goal>generate-module-info</goal>
</goals>
<configuration>
<modules>
<module>
<artifact>
<groupId>${moditect.sourceGroup}</groupId>
<artifactId>${moditect.sourceArtifact}</artifactId>
<version>${moditect.sourceVersion}</version>
</artifact>
</module>
</modules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
So. I think it's something like
mvn -P moditect package
but for some reason this requires that version has already been locally installed (mvn clean install
).
Further, I think you need to run this from sub-directory (like guava
etc), not from main level (since parent pom does not produce jar or bundle).
I'll check if I can make this work from home: and if so, it'd be great if you could double-check it, before I write it down. What I do remember is that Moditect plug-in is quite finicky, unfortunately.
from jackson-datatypes-collections.
A few findings:
- I had to edit
jackson-databind
'smodule-info.java
and remove the linerequires java.base;
from it. Otherwise, I got error like
Error reading module: .../.m2/repository/com/fasterxml/jackson/core/jackson-databind/3.0.0-SNAPSHOT/jackson-databind-3.0.0-SNAPSHOT.jar: Dependence upon java.base already declared
When generating module-infos in jackson-datatypes-collections.
- In order to do the first
mvn clean install
step injackson-datatypes-collections
, I commented out the corresponding sections in modules where module-infos didn't exist yet:
<!-- <plugin>-->
<!-- <groupId>org.moditect</groupId>-->
<!-- <artifactId>moditect-maven-plugin</artifactId>-->
<!-- </plugin>-->
Because otherwise, there is a chicken-and-egg problem with mvn clean install
as it wants src/moditect/module-info.java
to exist already. Maybe there is a "smarter" Maven-way to disable plugin/goal/phase temporarily, but commenting out (and then uncommenting, after mvn clean install
succeeds) worked just fine.
- After that, going to a module directory (like
primitive-collections-base
) and runningmvn -P moditect package
still failed, but before the failure, it created amodule-info.java
intarget/moditect/...
, which I then was able to copy tosrc/moditect/module-info.java
.
from jackson-datatypes-collections.
Another issue is that generated module-info doesn't look quite right to me (at least, it differs from module-infos generated previously), e. g. it has requires transitive
directives: https://github.com/FasterXML/jackson-datatypes-collections/pull/51/files#diff-ec0e4a55788bc9b83c3cb05dc8017bf0
from jackson-datatypes-collections.
@GedMarc any idea why that recently added java.base
dependency would be problematic here.
@leventov requires transitive
is sort of matter of taste, I think: it just means that a dependency is exposed automatically to whoever relies on module. If not, they will separately need to declare it.
You can manually change that to follow what other modules are doing, I think: initial generation does NOT necessarily produce 100% as-is optimal output. At least that was my take.
Oh, one other thing: ideally we would get module-info in 2.10
branch. It may differ slightly from 3.0 (master), but I think you can check out diffs between 2.10 / 3.0 of other collection modules like Guava.
from jackson-datatypes-collections.
@cowtowncoder java.base is kind of the root of the entire module structure, so shouldn't really be placed anywhere ever. Should maybe raise that as an actual issue on moditect, I know @lukehutch worked on it for a bit? I think perhaps he would know better on this. Any alterations to this module is forcibly done on the command line --add-opens etc - even in jlink/jpackage artefacts
In terms of requires transitive (forcing the module dependency down the module chain breaking clean separation), from what I remember, this is done whenever a class of a dependent module is exposed in a public api method. In these cases the dependency must be transitive.
requires static comes to play when supporting multiple versions of an API with different module names.
(Also why I never auto generate the module-info's, I've come to always code from bottom up adding only what is referenced. that method limit of 64k is extremely painful and libraries adding to that complexity size for me now is a bit erggg)
from jackson-datatypes-collections.
@GedMarc ok I am asking because you suggested that it should be added in jackson-databind
:
FasterXML/jackson-databind#2485
which seemed odd but (I thought) harmless. I can easily remove it, just want to make sure it should NOT be there, even if Moditect plug-in might suggest it (which I assume is where it came from)
And yes, I think as a rule of thumb if API exposes a type, that type should be transitive dependency.
from jackson-datatypes-collections.
omg oo sorry! covers face
I suppose lessons learnt, i got burnt on it trying to do the data.time exposures. I'm not having any issues though on my side using the current databind and annotations - then I have no idea where that error is coming from. It isn't really causing any hassles though
We'll see on the jre 11 tests soon soon *tm
from jackson-datatypes-collections.
You can see how ClassGraph uses ModiTect here:
https://github.com/classgraph/classgraph/blob/master/pom.xml
The reason for this usage was to build for JDK 7, but allow for proper requires
on JDK 9+.
Although fair warning, even putting module-info.class
into META-INF/versions/9
can cause older Spring and JBoss installations to crash, since they don't know how to parse the newer classfile format. (They depend on an old version of ASM, and it scans the whole classpath, even META-INF
, then throws exceptions on classfile versions it doesn't recognize.)
I don't think you ever need to add requires java.base
. No idea why that causes issues.
from jackson-datatypes-collections.
Will be interesting to see what kinds of issues users bump into with 2.10.0. I am hoping devs running on very old containers would use older Jackson versions, but one challenge is that due to CVEs reported there has been surprisingly strong push to newer versions.
And 2.10.0 is -- for better and worse -- the version where this torrent of CVEs will stop. So demand for upgrades should be high.
But so far I haven't really heard of issues with odd module-info.class
.
I did remove that base reference so it won't be in 2.10.1, fwtw.
from jackson-datatypes-collections.
@cowtowncoder could you please also remove requires java.base
in databind's master
branch?
from jackson-datatypes-collections.
Done. Odd that merge didn't do it...
from jackson-datatypes-collections.
Related Issues (20)
- Accept lowerCase enums for `Range` `BoundType` serialization HOT 3
- `ArrayListMultimapDeserializer` does not support multimaps inside another object as a property HOT 13
- Update default Guava dependency for Jackson 2.15 from Guava 21.0 to 23.6.1-jre
- There maybe a misusage in GuavaMultimapDeserializer.findTransformer method HOT 1
- Update default Guava dependency for Jackson 2.16 from Guava 23.x to 25.x
- `ImmutableRangeSet` fails to deserialize without explicit deserializer HOT 2
- Support `@JsonFormat(shape=STRING)` for serialization of `Range<T>` HOT 6
- PCollections module info (`module-info.class`) incorrect HOT 4
- Some deserializers throw unexpected `NullPointerException` when handling invalid input
- Add deserialization support for bracket notation Range HOT 2
- `GuavaCollectionDeserializer` still throws NPE in some circumstances
- `Cache` deserialization fails with NPE for `null` valued entries HOT 7
- `RangeSet` deserializer fails for content `null`s with NPE
- Triple support HOT 5
- Remove Guava (test) dependency
- Cache Serialization serializes empty contents HOT 6
- `@JsonDeserialize.contentConverter` does not work for non-builtin collections HOT 7
- Eclipse Collection serialization for Pairs does not work when upgrading to EC version 11.0.0 HOT 3
- GuavaMultimapDeserializer throws JsonMappingException: Expecting START_OBJECT, found FIELD_NAME HOT 2
- Rename "com.fasterxml.jackson" -> "tools.jackson" HOT 1
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 jackson-datatypes-collections.