Just forgot to mention a general warning for anybody trying to work with Java9: In case a project depends on auto modules (and it clearly does here), *please* don't publish/deploy such libraries to any public artifact repository. Such unnamed modules might change their name for unforced reasons(module name is not reflected by the artifactId) or forced reasons (non-unique module name, split packages might force rearranges classes over artifacts, etc.). We don't control every repository publishing to Central, so adding such quality rules would cause a lot of trouble. We need to depend on the awareness of the community that they publish their artifacts with care, otherwise the result could be that the concept of Jigsaw won't work and projects could be forced to stay on Java 8 for this.

thanks,
Robert

On Mon, 10 Apr 2017 19:22:15 +0200, Martin Desruisseaux <martin.desruisse...@geomatys.com> wrote:

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


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

Reply via email to