edvin / fxlauncher

Auto updating launcher for JavaFX Applications
Apache License 2.0
715 stars 107 forks source link

trouble with mvn exec:exec@deploy-app #177

Open CodingFun-Tai opened 4 years ago

CodingFun-Tai commented 4 years ago

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

4.0.0
<groupId>UpdateApp</groupId>
<artifactId>UpdateApp</artifactId>
<version>1.0.0-SNAPSHOT</version>

<dependencies>
    <dependency>
        <groupId>no.tornado</groupId>
        <artifactId>fxlauncher</artifactId>
        <version>1.0.20</version>
    </dependency>
</dependencies>

<properties>
    <!-- Installer Filename without suffix -->
    <app.filename>MyApp</app.filename>

    <!-- The JavaFX Application class name -->
    <app.mainClass>club.taicooks.Main</app.mainClass>

    <!-- The Application vendor used by javapackager -->
    <app.vendor>My Comapny</app.vendor>

    <!-- The Application version used by javapackager -->
    <app.version>1.0</app.version>

    <!-- Base URL where you will host the application artifacts -->
    <app.url>https://sublife.co/diet/</app.url>

    <!-- The app and launcher will be assembled in this folder -->
    <app.dir>${project.build.directory}/app</app.dir>

    <!-- Native installers will be built in this folder -->
    <app.installerdir>${project.build.directory}/installer</app.installerdir>

    <!-- Should the client downgrade if the server version is older than the 
        local version? -->
    <app.acceptDowngrade>false</app.acceptDowngrade>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <outputDirectory>${app.dir}</outputDirectory>
            </configuration>
        </plugin>
        <!-- Copy dependencies to appdir -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <configuration>
                <excludeScope>provided</excludeScope>
                <outputDirectory>${app.dir}</outputDirectory>
                <stripVersion>true</stripVersion>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <!-- Generate app.xml manifest -->
            <executions>
                <execution>
                    <id>create-manifest</id>
                    <phase>package</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <mainClass>fxlauncher.CreateManifest</mainClass>
                        <arguments>
                            <argument>${app.url}</argument>
                            <argument>${app.mainClass}</argument>
                            <argument>${app.dir}</argument>
                            <argument>--cache-dir=${app.cacheDir}</argument>
                            <argument>--accept-downgrade=${app.acceptDowngrade}</argument>
                            <argument>--include-extensions=jpg</argument>
                            <argument>${app.parameters}</argument>
                        </arguments>
                    </configuration>
                </execution>
                <!-- Embed app.xml inside fxlauncher.xml so we don't need to reference 
                    app.xml to start the app -->
                <execution>
                    <id>embed-manifest-in-launcher</id>
                    <phase>package</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>jar</executable>
                        <workingDirectory>${app.dir}</workingDirectory>
                        <arguments>
                            <argument>uf</argument>
                            <argument>fxlauncher.jar</argument>
                            <argument>app.xml</argument>
                        </arguments>
                    </configuration>
                </execution>
                <!-- Optional step to include custom UI, see https://github.com/edvin/fxlauncher-custom-ui -->
                <!--<execution> -->
                <!--<id>embed-custom-ui-in-launcher</id> -->
                <!--<phase>package</phase> -->
                <!--<goals> -->
                <!--<goal>exec</goal> -->
                <!--</goals> -->
                <!--<configuration> -->
                <!--<executable>jar</executable> -->
                <!--<workingDirectory>${app.dir}</workingDirectory> -->
                <!--<arguments> -->
                <!--<argument>uf</argument> -->
                <!--<argument>fxlauncher.jar</argument> -->
                <!--<argument>-C</argument> -->
                <!--<argument>${project.basedir}/../fxlauncher-custom-ui/target/classes</argument> -->
                <!--<argument>.</argument> -->
                <!--</arguments> -->
                <!--</configuration> -->
                <!--</execution> -->
                <!-- Create native installer. Feel free to add more arguments as needed. 
                    https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javapackager.html -->
                <execution>
                    <id>installer</id>
                    <phase>install</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>javapackager</executable>

                        <arguments>
                            <argument>-deploy</argument>
                            <argument>-native</argument>
                            <argument>-outdir</argument>
                            <argument>${app.installerdir}</argument>
                            <argument>-outfile</argument>
                            <argument>${app.filename}</argument>
                            <argument>-srcdir</argument>
                            <argument>${app.dir}</argument>
                            <argument>-srcfiles</argument>
                            <argument>fxlauncher.jar</argument>
                            <argument>-appclass</argument>
                            <argument>fxlauncher.Launcher</argument>
                            <argument>-name</argument>
                            <argument>${project.name}</argument>
                            <argument>-title</argument>
                            <argument>${project.name}</argument>
                            <argument>-vendor</argument>
                            <argument>${app.vendor}</argument>
                            <argument>-BappVersion=${app.version}</argument>
                            <argument>-Bidentifier=${project.groupId}.${project.artifactId}</argument>
                        </arguments>
                    </configuration>
                </execution>
                <!-- Copy application artifacts to remote site using scp (optional) -->
                <execution>
                    <id>deploy-app</id>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>scp</executable>
                        <arguments>
                            <argument>-r</argument>
                            <argument>target/app/.</argument>
                            <argument>${app.deploy.target}</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

edvin commented 4 years ago

Do you expect us to be able to help you in any meaningful way after describing the issue with a single word, "trouble"? :) What's the issue you're having, what error message do you get when running the command?

wcrozeta commented 4 years ago

The same "trouble" happened to me. So I updated maven version from 3.2.2 to 3.6.3 and the "trouble" gone.