Hello

I'm trying to port an existing Maven plugin from JDK8 to JDK9, but got
an error message which seems to be related (if I interpreted correctly)
to the way Maven classes are distributed in packages. My Maven
dependencies are:

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>3.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>3.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.5</version>
      <scope>provided</scope>
    </dependency>

My module-info.java file is:

    module org.apache.sis.core.build {
        requires java.xml;
        requires jdk.javadoc;
        requires maven.core;
        requires maven.model;
        requires maven.plugin.api;
        requires maven.plugin.annotations;
    }

The error that I get is:

    [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) 
on project sis-build-helper: Compilation failure: Compilation failure: 
    [ERROR] module  reads package org.apache.maven.plugin from both 
maven.plugin.api and maven.core
    [ERROR] module maven.plugin.annotations reads package 
org.apache.maven.plugin from both maven.core and maven.plugin.api
    [ERROR] module maven.plugin.api reads package org.apache.maven.plugin from 
both maven.core and maven.plugin.api
    [ERROR] module maven.model reads package org.apache.maven.plugin from both 
maven.core and maven.plugin.api
    [ERROR] module plexus.build.api reads package org.apache.maven.plugin from 
both maven.core and maven.plugin.api
    [ERROR] module plexus.utils reads package org.apache.maven.plugin from both 
maven.core and maven.plugin.api
    [ERROR] module maven.core reads package org.apache.maven.plugin from both 
maven.core and maven.plugin.api

Looking for the first error, I can see that maven-core-3.5.0.jar
contains the following files:

    org/apache/maven/plugin/BuildPluginManager.class
    org/apache/maven/plugin/CacheUtils.class
    (etc...)

and maven-plugin-api-3.5.0.jar contains the following files:

    org/apache/maven/plugin/AbstractMojo.class
    org/apache/maven/plugin/AbstractMojoExecutionException.class
    org/apache/maven/plugin/ContextEnabled.class

Maybe I misunderstood, but I though that we can not have two modules
exporting the same package with Jigsaw. Did I misunderstood something?
If not, is it a Maven work in progress or is there some know workaround?

    Thanks,

        Martin


Reply via email to