repaint-io / maven-tiles

Injecting maven configurations by composition rather than inheritance
154 stars 32 forks source link

JDK14 incompatibility when extensions=true #108

Closed kemitix closed 4 years ago

kemitix commented 4 years ago

A simple pom file, with the tiles-maven-plugin, fails when the extensions element is set to true.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.example</groupId>
    <artifactId>maven-tiles-jdk14-test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>io.repaint.maven</groupId>
                <artifactId>tiles-maven-plugin</artifactId>
                <version>2.16</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>
mvn clean > error.txt

error.txt

$ head error.txt 
[INFO] Scanning for projects...
[WARNING] Error injecting: io.repaint.maven.tiles.TilesMavenLifecycleParticipant
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
    at org.codehaus.groovy.runtime.dgmimpl.NumberNumberMetaMethod.<clinit> (NumberNumberMetaMethod.java:33)
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstanceWithCaller (Constructor.java:500)
    at java.lang.reflect.Constructor.newInstance (Constructor.java:481)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.createMetaMethodFromClass (MetaClassRegistryImpl.java:258)
kemitix commented 4 years ago

Maven 3.6.2:

$ mvn --version
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T16:06:16+01:00)
Maven home: /home/pcampbell/.sdkman/candidates/maven/current
Java version: 14, vendor: AdoptOpenJDK, runtime: /home/pcampbell/.sdkman/candidates/java/14.0.0.hs-adpt
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.19.0-8-amd64", arch: "amd64", family: "unix"
kemitix commented 4 years ago

Upgraded Maven to 3.6.3, but the error is still present.

talios commented 4 years ago

I wonder if this relates to the version of Groovy being used. A while ago I started a local branch upgrading it to the latest version which better supports modern java, but had some dependency/test issues I needed to work out.

I'll see if I can look at this soon.

stickycode commented 4 years ago

@talios Is this fixed with 1.17?

talios commented 4 years ago

@stickycode It's been reported that #110 now works - so I guess this does? We're not using >8 currently so can't test.

kemitix commented 4 years ago

@talios / @stickycode I can give 2.17 a test with JDK 14 and let you know. Would have tested sooner but didn't notice the new release.

kemitix commented 4 years ago

@talios / @stickycode Works using 2.17 with JDK 14.0.1 Thanks. :)