You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ja...@web.de on 2021/04/30 10:39:33 UTC

Accessing Maven Repository with Java11, SplitPackages

Dear Maven Developers,



I am currently struggling with a problem related to the
maven-resolver-provider in version 3.8.1 because its' inherent dependencies
seem to not be compatible with Java14.



This brought me to the question if there is an intention to migrate alike
maven projects to at least Java11, regarding the restriction of package
splitting since Java11.

( With the premise that maven-resolver-provider and such are built with
Java8, what wouldn't cause the problems at all. Sadly, I didn't find much
but some notes that many related projects are still developed under Java8. )




Derived from this more general question I can surely provide more
information about my special issue and for sure can create an actual Issue
on this, but as I am not that much experienced in this universe, I thought
I'd like to contact you in advance:



The maven-resolver-provider is the dependency that allows me to resolve a
Maven repository in Java with access to Artifacts and much more. What is
mainly what I want to do, and what worked with Java8 like a charm.

Since split packages are restricted in Java11, at startup Java throws
ResolutionExceptions as soon as the dependency* is declared. Amongst others,
the really concerning issue strikes as follows:



java.lang.module.ResolutionException: Modules maven.model and
maven.model.builder export package org.apache.maven.model.merge to module
maven.repository.metadata



Looking at these projects, one can easily see that the only class provided
by the maven-model-build -> org.apache.maven.model.merge package is a class
called "MavenModelMerger.java" extends "ModelMerger.java"

From maven-model project and seems to have no dependencies on the
maven-model-builder project at all. Couldn't this be moved to the
maven-model project to support Java11 at this point?

(The image below shows the imports for the MavenModelMerger.class.)

As you may have guessed, I really need these projects maven-model and
maven-model-builder, what directly leads to the above provided question: Are
there intentions to migrate these projects to a newer Java version?





PS: In case I am completely misleaded, I am sorry.



Best Regards,
Stay Healthy,
Jan Uhlig



*

<dependency>

      <groupId>org.apache.maven</groupId>

      <artifactId>maven-resolver-provider</artifactId>

      <version>3.8.1</version>

</dependency>



The following image demonstrates the imports in the MavenModelMerger class:




Re: Accessing Maven Repository with Java11, SplitPackages

Posted by Robert Scholte <rf...@apache.org>.
The codebase of Maven is over 15 years old and you can clearly see that it has evolved over the years. This implies that sometimes we've decided to move classes from one jar to the other.
On the classpath this is not an issue and as Maven is using only the classpath to run there is no issue here.

Having said that, you're clearly trying to use the maven-resolver-provider on the module-path, which is not going to work without any tricks (such as providing extra flags to java / javac or to rebundle jars).
However, Java 11 (or actually Java 9) doesn't mean you can't use the classpath anymore.

Currently there is no need for Maven to switch to the module path. Assuming we would do that, we need to rename packages which would probably make all current maven-plugins useless.It comes with much more pain than gain.
So the advice is: remove your module-info file and stay on the classpath

Robert
On 30-4-2021 22:45:57, jan.uhlig01@web.de <ja...@web.de> wrote:
Dear Maven Developers,
 
I am currently struggling with a problem related to the maven-resolver-provider in version 3.8.1 because its’ inherent dependencies seem to not be compatible with Java14.
 
This brought me to the question if there is an intention to migrate alike maven projects to at least Java11, regarding the restriction of package splitting since Java11.
( With the premise that maven-resolver-provider and such are built with Java8, what wouldn’t cause the problems at all. Sadly, I didn’t find much but some notes that many related projects are still developed under Java8. )
 
Derived from this more general question I can surely provide more information about my special issue and for sure can create an actual Issue on this, but as I am not that much experienced in this universe, I thought I’d like to contact you in advance:
 
The maven-resolver-provider is the dependency that allows me to resolve a Maven repository in Java with access to Artifacts and much more. What is mainly what I want to do, and what worked with Java8 like a charm.
Since split packages are restricted in Java11, at startup Java throws ResolutionExceptions as soon as the dependency* is declared. Amongst others, the really concerning issue strikes as follows:
 
java.lang.module.ResolutionException: Modules maven.model and maven.model.builder export package org.apache.maven.model.merge to module maven.repository.metadata
 
Looking at these projects, one can easily see that the only class provided by the maven-model-build -> org.apache.maven.model.merge package is a class called “MavenModelMerger.java” extends “ModelMerger.java”
From maven-model project and seems to have no dependencies on the maven-model-builder project at all. Couldn’t this be moved to the maven-model project to support Java11 at this point?
(The image below shows the imports for the MavenModelMerger.class.)
As you may have guessed, I really need these projects maven-model and maven-model-builder, what directly leads to the above provided question: Are there intentions to migrate these projects to a newer Java version?
 
 
PS: In case I am completely misleaded, I am sorry.
 
Best Regards,
Stay Healthy,
Jan Uhlig
 
*
<dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-resolver-provider</artifactId>
      <version>3.8.1</version>
</dependency>
 
The following image demonstrates the imports in the MavenModelMerger class: