You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Mark Raynsford <or...@io7m.com> on 2017/10/20 12:26:35 UTC

Maven plugins, Java 9, and split packages

Hello.

I'm experimenting with modularizing an existing plugin (japicmp [0])
and am running into hundreds of errors of the form:

[ERROR] the unnamed module reads package org.apache.maven.plugin from both maven.plugin.api and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.resolver from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.resolver.filter from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.repository from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.repository.metadata from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.repository.layout from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.metadata from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.handler from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.handler.manager from both maven.artifact and maven.core
[ERROR] the unnamed module reads package org.apache.maven.artifact.factory from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.plugin from both maven.plugin.api and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.resolver from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.resolver.filter from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.repository from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.repository.metadata from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.repository.layout from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.metadata from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.handler from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.handler.manager from both maven.artifact and maven.core
[ERROR] module maven.plugin.annotations reads package org.apache.maven.artifact.factory from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.plugin from both maven.plugin.api and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.resolver from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.resolver.filter from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.repository from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.repository.metadata from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.repository.layout from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.metadata from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.handler from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.handler.manager from both maven.artifact and maven.core
[ERROR] module maven.plugin.api reads package org.apache.maven.artifact.factory from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.plugin from both maven.plugin.api and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.resolver from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.resolver.filter from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.repository from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.repository.metadata from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.repository.layout from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.metadata from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.handler from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.handler.manager from both maven.artifact and maven.core
[ERROR] module maven.artifact reads package org.apache.maven.artifact.factory from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.plugin from both maven.plugin.api and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.resolver from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.resolver.filter from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.repository from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.repository.metadata from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.repository.layout from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.metadata from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.handler from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.handler.manager from both maven.artifact and maven.core
[ERROR] module com.google.common reads package org.apache.maven.artifact.factory from both maven.artifact and maven.core

This looks to be a case of split packages amongst all of the various
Maven artifacts. I'm adding dependency exclusions to try to work around
the issues, but I'm not confident that'll actually work.

Are there efforts underway to clean this stuff up?

The reason I'm modularizing the plugin is due to this:

  "To build and run japicmp under Java 1.9, you must add the following module: java.xml.bind. This can be done for the maven plugin for example by:

export MAVEN_OPTS="--add-modules java.xml.bind"

I'd rather not have to do this as I'm committed to having all of my
project builds run without needing extra Maven flags: "mvn clean install"
*must* just work on every system, no exceptions.

Am I undertaking a fool's errand trying to get this stuff to work cleanly?
If not, is there any documentation on modularizing existing plugins?

[0] https://github.com/siom79/japicmp/

-- 
Mark Raynsford | http://www.io7m.com


Re: Maven plugins, Java 9, and split packages

Posted by Mark Raynsford <or...@io7m.com>.
On 2017-10-20T14:43:52 +0200
"Robert Scholte" <rf...@apache.org> wrote:
>
> > This looks to be a case of split packages amongst all of the various
> > Maven artifacts. I'm adding dependency exclusions to try to work around
> > the issues, but I'm not confident that'll actually work.
> >
> > Are there efforts underway to clean this stuff up?  
> 
> No, Maven has its own modular system long before the Java Platform Modular  
> System (JPMS)...

OK, makes sense. I was seeing errors related to Class.byName in some of
the exceptions I was seeing, so I mistakenly assumed that there was
some degree of modularization underway that possibly wasn't quite
complete yet. I suspect the actual problems I'm seeing here are just
out-of-date dependencies.

> > The reason I'm modularizing the plugin is due to this:
> >
> >   "To build and run japicmp under Java 1.9, you must add the following  
> > module: java.xml.bind. This can be done for the maven plugin for example  
> > by:
> >
> > export MAVEN_OPTS="--add-modules java.xml.bind"  
> 
> IIUC this doesn't mean you have to introduce a module descriptor (i.e.  
> module-info.java ).
> 
> The reason is that this module is marked as deprecated and won't be  
> activated by the JDK/JRE by default. By adding this argument it is loaded  
> anyway.
> 
> What you should try to do instead is add the following dependency:
> <dependency>
>      <groupId>javax.xml.bind</groupId>
>      <artifactId>jaxb-api</artifactId>
>      <version>2.3.0</version>
> </dependency>

Noted, thanks! I'll be testing this out today.

-- 
Mark Raynsford | http://www.io7m.com


Re: Maven plugins, Java 9, and split packages

Posted by Robert Scholte <rf...@apache.org>.
>
> This looks to be a case of split packages amongst all of the various
> Maven artifacts. I'm adding dependency exclusions to try to work around
> the issues, but I'm not confident that'll actually work.
>
> Are there efforts underway to clean this stuff up?

No, Maven has its own modular system long before the Java Platform Modular  
System (JPMS).
Due to the evolution of Maven over the last decade there are indeed split  
packages, which was never an issue.
Cleaning up is simply not possible and not necessary, unless we make a  
monolith of it, which is actually the opposite of want you want to achieve  
with modularization.
Cleaning up would mean introducing new packages, which would effectively  
make all current maven-plugins useless.
For that reason I see no reason to make it JPMS-modular.

>
> The reason I'm modularizing the plugin is due to this:
>
>   "To build and run japicmp under Java 1.9, you must add the following  
> module: java.xml.bind. This can be done for the maven plugin for example  
> by:
>
> export MAVEN_OPTS="--add-modules java.xml.bind"

IIUC this doesn't mean you have to introduce a module descriptor (i.e.  
module-info.java ).

The reason is that this module is marked as deprecated and won't be  
activated by the JDK/JRE by default. By adding this argument it is loaded  
anyway.

What you should try to do instead is add the following dependency:
<dependency>
     <groupId>javax.xml.bind</groupId>
     <artifactId>jaxb-api</artifactId>
     <version>2.3.0</version>
</dependency>

thanks,
Robert

>
> I'd rather not have to do this as I'm committed to having all of my
> project builds run without needing extra Maven flags: "mvn clean install"
> *must* just work on every system, no exceptions.
>
> Am I undertaking a fool's errand trying to get this stuff to work  
> cleanly?
> If not, is there any documentation on modularizing existing plugins?
>
> [0] https://github.com/siom79/japicmp/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org