arquillian-rusheye icon indicating copy to clipboard operation
arquillian-rusheye copied to clipboard

Unable to use rusheye-impl via maven in java11 due to jar-with-dependencies

Open kiicia opened this issue 3 years ago • 0 comments

Issue Overview

When using rusheye-impl in java 11 project there is problem with duplicated packages between modulepath and classpath:

The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml

For example project I am maintaining and updating java 8 -> java 11 has problems with packages:

  • javax.xml.parsers
  • org.w3c.dom
  • org.xml.sax

This is caused by building rusheye-impl (as seen in pom.xml) as jar-with-dependencies:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>jar-with-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <finalName>rusheye-core</finalName>
              <appendAssemblyId>false</appendAssemblyId>
              <archive>
                <manifest>
                  <mainClass>org.arquillian.rusheye.Main</mainClass>
                </manifest>
              </archive>
              <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
              </descriptorRefs>
            </configuration>
          </execution>
        </executions>
      </plugin>

As I understand this allowed for one-jar apps, but it also causes you being unable to exclude selected dependencies when used in bigger project with many other dependencies.

For example project I am maintaining actually uses ocular, which depends on rusheye-impl:

<groupId>com.testautomationguru.ocular</groupId>
<artifactId>ocular</artifactId>
<version>1.0.0.Alpha</version>

... but I am unable to exclude any packages because it is already contained in rusheye-impl.jar that is downloaded from maven (I am preparing custom jar tho).

Expected Behaviour

Java 11 compatibility, possibly by:

  • ~~creating another artifact that is not jar-with-dependencies so you can exclude what you need to (additional/alternative artefact in maven repository)~~
  • ~~creating version that is compatible with java 11 (new version in maven repository)~~
  • fixing rusheye-impl pom to remove assembly plugin (thus creating lean jar) and deploying it as 1.0.1 to maven repository, then everyone affected can use dependency management to use version 1.0.1

[edit]

I was able to remove assembly plugin, change version and compile it, however it won't compile/pass tests in java 11 (compiled it in java 8, used within java 11 project using in-project repository and dependency management overriding version used by ocular)

seeing how pom.xml files look like, it seems like:

  • rusheye-impl - was supposed to be lean jar (packed with no dependencies) used as maven dependency in other projects
  • rusheye-dist - was supposed to be fat jar (packed with dependencies) used for one-jar applications, as it's only dependency is rusheye-impl (it was supposed to repack it along with all dependencies)

assembly plugin in rusheye-impl was introduced in commit: commit 99a13656b0ff3e2956db40f9f102a8c00811b7be added assembly of rusheye-core

but it was not removed when rusheye-dist was added year later: commit 8dfeb0ae199f1c95c2e689bf105c4c46b1273b5c added distribution configuration

kiicia avatar Mar 29 '21 09:03 kiicia