Uploaded image for project: 'Maven WAR Plugin'
  1. Maven WAR Plugin
  2. MWAR-397

Replace XStream with Modello to merge overlays

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Resolved
    • None
    • 3.3.0
    • None
    • None

    Description

      When packaging a war with most recent jigsaw-jdk9-ea releases you will get the following exception:

      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "exports private java.util" to unnamed module @17088b23
          at jdk.internal.reflect.Reflection.throwInaccessibleObjectException (Reflection.java:414)
          at java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:198)
          at java.lang.reflect.Field.checkCanSetAccessible (Field.java:171)
          at java.lang.reflect.Field.setAccessible (Field.java:165)
          at com.thoughtworks.xstream.core.util.Fields.locate (Fields.java:40)
          at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit> (TreeMapConverter.java:50)
          at com.thoughtworks.xstream.XStream.setupConverters (XStream.java:832)
          at com.thoughtworks.xstream.XStream.<init> (XStream.java:574)
          at com.thoughtworks.xstream.XStream.<init> (XStream.java:496)
          at com.thoughtworks.xstream.XStream.<init> (XStream.java:465)
          at com.thoughtworks.xstream.XStream.<init> (XStream.java:411)
          at com.thoughtworks.xstream.XStream.<init> (XStream.java:378)
          at org.apache.maven.plugins.war.util.WebappStructureSerializer.<clinit> (WebappStructureSerializer.java:47)
      

      Root cause is the change is the jigsaw-jdk-9-ea+135

      The changes to setAccessible in #AwkwardStrongEncapsulation is going to
      be disruptive and will no doubt expose hacks in many areas. We've run
      into several of these already. The command line option to allow existing
      code to break into non-public types/members is --add-exports-private.
      The format of the value passed to this option is the same--add-exports.
      With #AddExportsInManifest then there are equivalents in the application
      JAR main manifest to try out too.

      The stacktrace exposes that the issue is caused by XStream. It seems that XStream is used to be able to merge overlays. Maven and most other plugins use Modello for these kind of things.

      There's still a lot of discussion about #ReflectiveAccessToNonExportedTypes and #AwkwardStrongEncapsulation and but I think we can avoid this issue by simply switching to the well known Modello solution.

      Attachments

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              rfscholte Robert Scholte
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: