You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Martin Desruisseaux <ma...@geomatys.com> on 2017/04/10 17:22:15 UTC
Creating custom plugin with JDK9: conflict with Maven packages?
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
[IMPORTANT] Re: Creating custom plugin with JDK9: conflict with Maven
packages?
Posted by Robert Scholte <rf...@apache.org>.
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
<ma...@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-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Creating custom plugin with JDK9: conflict with Maven packages?
Posted by Robert Scholte <rf...@apache.org>.
Hi Martin,
that's true: the same packages cannot be exported by different jars.
I have no plans for this yet, let's first make it possible to use Java 9
in general (not Maven specific projects).
The impact of reordering the packages just because Jigsaw demands it now
will have a huge impact. I doubt we can fix that soon.
Robert
On Mon, 10 Apr 2017 19:22:15 +0200, Martin Desruisseaux
<ma...@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-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org