我想使用maven3将kotlin / tornadofx项目的JAR打包

时间:2018-11-14 12:39:45

标签: maven javafx kotlin tornadofx

JDK 11和JavaFX依赖项的创建JAR出错了。 Fat JAR正在构建,但是执行无法正常工作,请参见下面的错误...

这是我的MANIFEST.MF:


Manifest-Version: 1.0
Created-By: Apache Maven 3.5.4
Built-By: gerri
Build-Jdk: 11.0.1
Class-Path: javax.json-api-1.1.2 tornadofx-1.7.17 kotlin-reflect-1.2.60 
 kotlin-stdlib-1.3.0-rc-198 kotlin-stdlib-common-1.3.0-rc-198 kotlin-std
 lib-jdk7-1.2.60 kotlin-stdlib-jdk8-1.2.60 javax.json-1.1.2 annotations-
 13.0
Main-Class: de.auticon.maven.tornadofx.MainAppKt

P。 S.我想用maven3打包JAR,用IntelliJ IDEA打包b / c,它也没有运行!

根据要求更新了pom.xml


<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>de.auticon.maven.tornadofx</groupId>
    <artifactId>de-auticon-maven-tornadofx</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>de.auticon.maven.tornadofx de-auticon-maven-tornadofx</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.version>1.3.0-rc-198</kotlin.version>
        <kotlin.code.style>official</kotlin.code.style>
        <junit.version>4.12</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>no.tornado</groupId>
            <artifactId>tornadofx</artifactId>
            <version>1.7.17</version>
        </dependency>

        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11-ea+19</version>
        </dependency>

    </dependencies>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <archive>
                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>

            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <configuration>
                    <jvmTarget>1.8</jvmTarget>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <!-- get all project dependencies -->
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <!-- MainClass in mainfest make a executable jar -->
                    <archive>
                      <manifest>
                        <mainClass>de.auticon.maven.tornadofx.MainAppKt</mainClass>
                      </manifest>
                    </archive>

                </configuration>
                <executions>
                  <execution>
                    <id>make-assembly</id>
                                        <!-- bind to the packaging phase -->
                    <phase>package</phase> 
                    <goals>
                        <goal>single</goal>
                    </goals>
                  </execution>
                </executions>
            </plugin>


        </plugins>
    </build>

</project>

我真的需要here?所述的javafxpackager

FatJAR正在构建,但未执行:

D:\Source\deauticonmaventornadofx\target>java -jar de-auticon-maven-tornadofx-1.0-SNAPSHOT-jar-with-dependencies.jar
Error: JavaFX runtime components are missing, and are required to run this application

0 个答案:

没有答案