2

I was Updating my Java Swing project from 1.8 to Open Source JDK 12. So i create a parent App and then a JLink module app, and add parent to my original project.

When i try to run clean package, I got this error:

Failed to execute goal org.apache.maven.plugins:maven-jmod-plugin:3.0.0-alpha-1:create (default-create) on project viewer: Execution default-create of goal org.apache.maven.plugins:maven-jmod-plugin:3.0.0-alpha-1:create failed.

My POM file structure are below.

Parent Pom:

<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>com.hashscan</groupId>
<artifactId>parent</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>

<name>parent</name>
<url>http://maven.apache.org</url>

<properties>
    <maven.compiler.target>12</maven.compiler.target>
    <maven.compiler.source>12</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://localhost:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
        <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
    <site>
        <id>site</id>
        <url>file://${HOME}/distribution/site/</url>
    </site>
</distributionManagement>

<modules>
    <module>triage-viewer</module>
    <module>mod-jlink</module>
</modules>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jlink-plugin</artifactId>
            <version>3.0.0-alpha-1</version>
            <extensions>true</extensions>
            <dependencies>
                <dependency>
                    <groupId>org.ow2.asm</groupId>
                    <artifactId>asm</artifactId>
                    <version>6.2</version> <!-- Use newer version of ASM -->
                </dependency>
            </dependencies>
            <configuration>
                <noHeaderFiles>true</noHeaderFiles>
                <noManPages>true</noManPages>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jmod-plugin</artifactId>
            <version>3.0.0-alpha-1</version>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
                <!-- ! Currently turned off enforcer cause ! we are using SNAPSHOT versions 
                    of plugins ! which are by default forbidden by ! the inherited enforcer rules. -->
                <execution>
                    <id>enforce-maven</id>
                    <phase>UNKNOWN</phase>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-toolchains-plugin</artifactId>
            <executions>
                <execution>
        <?m2e ignore ?>
                    <goals>
                        <goal>toolchain</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <toolchains>
                    <jdk>
                        <version>12</version>
                        <vendor>oracle</vendor>
                    </jdk>
                </toolchains>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.9</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

App Pom:

<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>

<parent>
    <groupId>com.hashscan</groupId>
    <artifactId>parent</artifactId>
    <version>0.0.1</version>
</parent>

<artifactId>viewer</artifactId>
<packaging>jmod</packaging>

<dependencies>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.11.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.miglayout/miglayout -->
    <!-- <dependency>
        <groupId>com.miglayout</groupId>
        <artifactId>miglayout</artifactId>
        <version>3.7.4</version>
    </dependency> -->

    <!-- https://mvnrepository.com/artifact/com.miglayout/miglayout-swing -->
    <dependency>
        <groupId>com.miglayout</groupId>
        <artifactId>miglayout-swing</artifactId>
        <version>5.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->

    <!-- https://mvnrepository.com/artifact/commons-dbcp/commons-dbcp -->
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.4</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
    <dependency>
        <groupId>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3.21.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.bushe</groupId>
        <artifactId>eventbus</artifactId>
        <version>1.4</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.11</version>
    </dependency>

    <dependency>
        <groupId>org.yaml</groupId>
        <artifactId>snakeyaml</artifactId>
        <version>1.14</version>
    </dependency>


    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.3</version>
    </dependency>

    <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.7</version>
        </dependency>

    <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.1</version>
    </dependency>

    <!-- <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api-osgi</artifactId>
        <version>2.2.7</version>
    </dependency> -->

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.3.1</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>2.3.0.1</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-osgi</artifactId>
        <version>2.3.1</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.json</artifactId>
        <version>1.1</version>
    </dependency>

    <dependency>
        <groupId>org.custome.addones</groupId>
        <artifactId>example-app</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/synthetica/themes/syntheticaBlackEye.jar</systemPath>
    </dependency>

    <dependency>
        <groupId>org.custom.addones</groupId>
        <artifactId>example-app</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/synthetica/themes/syntheticaAluOxide.jar</systemPath>
    </dependency>

    <dependency>
        <groupId>org.custom1.addones</groupId>
        <artifactId>example-app</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/synthetica/synthetica.jar</systemPath>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.tika/tika -->
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika</artifactId>
        <version>1.19</version>
        <type>pom</type>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.tika/tika-core -->
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-core</artifactId>
        <version>1.19</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.tika/tika-bundle -->
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-bundle</artifactId>
        <version>1.19</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-compress</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-csv</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.tika/tika-xmp -->
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-xmp</artifactId>
        <version>1.19</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.tika/tika-app -->
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-app</artifactId>
        <version>1.19</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-compress</artifactId>
            </exclusion>
            <exclusion>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.lucene/lucene-core -->
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-core</artifactId>
        <version>7.5.0</version>
    </dependency>

    <dependency>
        <groupId>org.ehcache</groupId>
        <artifactId>ehcache</artifactId>
        <version>3.4.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

Linker Pom:

    <?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.hashscan</groupId>
    <artifactId>parent</artifactId>
    <version>0.0.1</version>
  </parent>

  <artifactId>mod-jlink</artifactId>
  <name>mod-jlink</name>
  <packaging>jlink</packaging>

  <url>http://maven.apache.org</url>

  <dependencies>
    <dependency>
      <groupId>com.hashscan</groupId>
      <artifactId>viewer</artifactId>
      <version>${project.version}</version>
      <type>jmod</type>
    </dependency>
    </dependencies>
</project>

Thank you

Aqeel Haider
  • 537
  • 5
  • 18

1 Answers1

1

According to this, you need to upgrade asm to 7.1. Cause is the Java version as this plugin is designed for Java 9.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jmod-plugin</artifactId>
    <version>3.0.0-alpha-2-SNAPSHOT</version>
    <extensions>true</extensions>
    <dependencies>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>7.1</version>
        </dependency>
    </dependencies>
</plugin>

This worked for me. As stated in this issue, this will be fixed in future releases (s.a. 3.0.0-alpha-2).

raphaelmue
  • 21
  • 4
  • How do I get hold of 3.0.0-alpha-2-SNAPSHOT? The maven central repository only lists version 3.0.0-alpha-1 – Michael Ellis Jun 09 '20 at 12:38
  • [Here](https://builds.apache.org/job/maven-box/job/maven-jmod-plugin/job/master/) you can see the latest build artifacts of the jmod plugin. You can download the latest `.jar` and `.pom` file and install them manually (into `~/.m2/repository/org/apache/maven/plugins/maven-jmod-plugin/3.0.0-alpha-2-SNAPSHOT/`). This is of course just a work-around. Hope they'll release it soon. – raphaelmue Jun 12 '20 at 12:34
  • THANK YOU! I will give that a try! – Michael Ellis Jun 13 '20 at 13:03
  • For anyone else struggling having downloaded the maven-jmod-plugin-3.0.0-alpha-2-SNAPSHOT.jar as suggested by raphaelmue, I was able to install it with the following maven command: mvn install:install-file -DgroupId=org.apache.maven.plugins \ -DartifactId=maven-jmod-plugin \ -Dversion=3.0.0-alpha-2-SNAPSHOT \ -Dfile=maven-jmod-plugin-3.0.0-alpha-2-SNAPSHOT.jar \ -Dpackaging=jar \ -DgeneratePom=true – Michael Ellis Jun 14 '20 at 08:51