maven-jmod-plugin:3.0.0-alpha-1 Give错误创建失败。 IllegalArgumentException

时间:2019-07-05 12:21:21

标签: java maven jlink jmod

我正在将Java Swing项目从1.8更新到开源JDK12。因此,我先创建了父应用程序,然后又创建了JLink模块应用程序,并将父项添加到我的原始项目中。

当我尝试运行干净的程序包时,出现此错误:

无法在项目查看器上执行目标org.apache.maven.plugins:maven-jmod-plugin:3.0.0-alpha-1:create(默认创建):目标org.apache.maven的执行默认创建.plugins:maven-jmod-plugin:3.0.0-alpha-1:create失败。

我的POM文件结构如下。

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

链接器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>

谢谢

1 个答案:

答案 0 :(得分:1)

根据this,您需要将asm升级到7.1。原因是Java版本,因为此插件是为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>

这对我有用。如本期所述,此问题将在以后的版本中(例如3.0.0-alpha-2)修复。