Re: MJAR maven 4 usage and deps
Romain Manni-Bucau <[email protected]>
| Newsgroups | gmane.comp.jakarta.turbine.maven.devel |
|---|---|
| Message-ID | <CACLE=7NiT=E-i9kpacjPhqTBdKZT5-GrCwZhj_Z9=gBTYWQ7Hw@mail.gmail.com> |
let say I have a class AwesomeService, i want a java 8 impl (src/main/java) which uses jackson 2 and a java 25 version which uses jackson 3 (META-INF/versions/25). how do I handle that since both are literally like different codebase. in other words it seems we only handle java specificities but in today's world the java version related specificities is about transitive dependencies too so we should be able to configure a <dependencies> block per source directory IMHO with overrides of the default block. The current maven 3 workaround to have a multimodule project works well but if we want it to be a first citizen in maven 4 it seems we just missed the core design of the feature if it is not possible. Adding dependencies block in source dirs can be a no brainer but overrides are harder since GA can be different - I even potentially have a case where the lib is not the same at all, like serp (java 6+) vs asm (java 8+) vs classfile API (java 25+, no dep). (if unclear I'd like we limit the modelVersion we do promote with promoting maven 4, I know we can change often but it is hurtful everytime we do so trying to mitigate it ensuring we cover the common use cases) Romain Manni-Bucau @rmannibucau <https://x.com/rmannibucau> | .NET Blog <https://dotnetbirdie.github.io/> | Blog <https://rmannibucau.github.io/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/en-us/product/java-ee-8-high-performance-9781788473064> Javaccino <https://javaccino.dev/> founder (Java/.NET service - contact via linkedin) Le jeu. 27 août 2026 à 09:37, Martin Desruisseaux via dev < [email protected]> a écrit : > Le 27/08/2026 à 09:19, Romain Manni-Bucau a écrit : > > > I'm having a headache to see how our new design with types for > dependencies > > and mjar layout work together: how can i get different deps for different > > java version in the same jar? > > I'm not sure which dependencies the question is about: > > * The "Classpath" attribute in MANIFEST.MF? > * The module-info.class? > * The pom.xml in META-INF/maven directory? > > To my knowledge, there is no mechanism for providing different values of > the above depending on the version. It could be possible for > `module-info.class` but I'm not completely sure that it would work. > > Martin > >