java - maven-jmod-plugin :3. 0.0-alpha-1 给出错误创建失败。非法参数异常

标签 java maven jlink jmod

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

当我尝试运行干净的包时,我收到此错误:

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

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

应用程序 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>

谢谢

最佳答案

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

这对我有用。如本期所述,该问题将在未来版本中修复(s.a.3.0.0-alpha-2)。

关于java - maven-jmod-plugin :3. 0.0-alpha-1 给出错误创建失败。非法参数异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56902967/

相关文章:

javax.mail.MessagingException : Could not connect to SMTP host locally via netbeans

java - 代理后面的 Arquillian/Shrinkwrap MavenDependencyResolver

java - 如何获取Java类的真实模块依赖关系?

java - Java 8 中不同语言环境的记名月份名称

Java ORM,Java bean可以映射到 View 吗

java - RPM 文件不是使用 Maven rpm 插件生成的

java - OpenJDK 13/jpackage - Windows 下捆绑应用程序和运行时的问题

java - 在 JLink 构建上从外部 url 加载图像时握手失败

java - JUnit 文件结构、最佳实践(辅助类放置)

java - Struts2-tiles-plugin 2.3.28 - StrutsTilesListener 抛出 NullPointerException