Brauche Hilfe bei der Konfiguration von maven .pom zu bauen .exe-Datei

Muss ich erstellen exe-Datei mithilfe von maven. Ich habe gehört, dass gradle ist besser für diesen Zweck, aber ich weiß nicht, noch nichts davon. Meine aktuelle .pom-Datei:

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ediagent.edi</groupId>
    <artifactId>javafx</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>exe</packaging>

    <name>javafx</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>com.myapp.Main</mainClass>
    </properties>

    <organization>
        <!-- Used as the 'Vendor' for JNLP generation -->
        <name>Your Organisation</name>
    </organization>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeScope>system</excludeScope>
                            <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>

                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>${java.home}/../bin/javafxpackager</executable>
                            <arguments>
                                <argument>-createjar</argument>
                                <argument>-nocss2bin</argument>
                                <argument>-appclass</argument>
                                <argument>${mainClass}</argument>
                                <argument>-srcdir</argument>
                                <argument>${project.build.directory}/classes</argument>
                                <argument>-outdir</argument>
                                <argument>${project.build.directory}</argument>
                                <argument>-outfile</argument>
                                <argument>${project.build.finalName}.jar</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-cli</id>
                        <goals>
                            <goal>exec</goal>                            
                        </goals>
                        <configuration>
                            <executable>${java.home}/bin/java</executable>

                        </configuration>
                    </execution>
                </executions>  
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArguments>
                        <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <additionalClasspathElements>
                        <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
                    </additionalClasspathElements>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>native-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <executable>${java.home}/bin/java</executable>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Gibt es genügend Informationen für den Bau .exe-Datei? wenn nicht, was ich muss hinzufügen, und was als Nächstes zu tun?

Wenn Sie möchten, eine .exe, Java ist nicht die richtige Sprache für den job. Wenn Sie immer noch wollen, es gibt genug Werkzeuge zur Verfügung zu generieren .exe von Ihrem .Glas, aber zuerst Fragen Sie sich: warum?
warum? 1) Die wesentliche Anforderung zu schreiben, das Projekt auf java. 2) java ist die einzige Sprache, die ich kenne im moment
Java ist Plattform-unabhängig. Durch das erstellen einer exe-Datei, werden Sie nicht das hinzufügen der Funktionalität, die ein .jar-Datei nicht zur Verfügung stellen kann, aber Sie machen es Plattform abhängig, da .exe ist ein Windows-native OS.
das Haupt-OS in unserem Land ist Windows und die app ist für einen konkreten Kunden, die Windows verwenden. und ausführen jar-Datei für die einfache Benutzer-os zu schwierig

InformationsquelleAutor Nikitin Mikhail | 2015-05-18

Schreibe einen Kommentar