Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's New Feature Problem #125

Closed
mertakozcan opened this issue Jul 15, 2018 · 7 comments
Closed

What's New Feature Problem #125

mertakozcan opened this issue Jul 15, 2018 · 7 comments

Comments

@mertakozcan
Copy link

Hi,

I was trying to use What's New feauture but there is a point I don't get. In readme, it says that we should embed whatsnew.html to fxlauncher.jar, and set --whats-new argument for manifest. AFAIK, we can't update fxlauncher.jar, so how are we supposed to show What's New page to user after every update? What am I missing?

Here is my pom.xml, (irrelevant parts are removed)

<?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>...</groupId>
    <artifactId>...</artifactId>
    <version>0.0.0.1</version>

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

        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <version>8.40.11</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.5</version>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <!-- Installer file name without suffix -->
        <app.name>...</app.name>

        <!-- Optional override to specify where the cached files are stored. Default is current working directory -->
        <app.cacheDir>.</app.cacheDir>

        <!-- The JavaFX Application class name -->
        <app.mainClass>controller.MainApp</app.mainClass>

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

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

        <!-- Base URL where you will host the application artifacts -->
        <app.url>myapp.herokuapp.com/</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>

        <!-- Allow the client to 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-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${app.dir}</outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>controller.MainApp</mainClass>
                        </manifest>
                    </archive>
                    <outputDirectory>${app.dir}</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <!-- Generate app.xml manifest -->
                <executions>
                    <execution>
                        <id>copy-whatsnewfile</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}/src/main/resources</argument>
                                <argument>whatsnew.html</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <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>--whats-new=whatsnew.html</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>
                    <execution>
                        <id>installer</id>
                        <phase>install</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>javapackager</executable>
                            <arguments>
                                <argument>-deploy</argument>
                                <argument>-appclass</argument>
                                <argument>fxlauncher.Launcher</argument>
                                <argument>-native</argument>
                                <argument>-outdir</argument>
                                <argument>${app.installerdir}</argument>
                                <argument>-outfile</argument>
                                <argument>${app.name}</argument>
                                <argument>-srcdir</argument>
                                <argument>${app.dir}</argument>
                                <argument>-srcfiles</argument>
                                <argument>fxlauncher.jar</argument>
                                <argument>-name</argument>
                                <argument>${project.name}</argument>
                                <argument>-title</argument>
                                <argument>${app.name}</argument>
                                <argument>-vendor</argument>
                                <argument>${app.vendor}</argument>
                                <argument>-BappVersion=${app.version}</argument>
                                <argument>-Bidentifier=${project.groupId}.${project.artifactId}</argument>
                                <argument>-BshortcutHint=true</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

After I packaged my project, I can see that whatsnew.html is inside fxlauncher.jar. However, the problem is that my users won't be able to get new fxlauncher.jar, and since I set --whats-new argument, after a user updates the app, FXLauncher looks for that file but obviously can't find, because it didn't download the new fxlauncher.jar.

So the question is, can I show a What's New page to user after every automatic update?

@edvin
Copy link
Owner

edvin commented Jul 16, 2018

Hi! I'm not the architect of the whatsnew feature, but it seems the URL is stored in the manifest, and it can (and should) point to an external URL. So simply give it a publicly available/external URL and it should update just fine. Does that work for you? (I've updated the README)

@mertakozcan
Copy link
Author

Hi Edvin,

If you look at here, it actually loads html file from class path. Am I wrong about this?

@edvin
Copy link
Owner

edvin commented Jul 16, 2018

You’re correct. Not sure this was thought through. Let’s change it to simply show the given URL :) @ronsmits any input?

@mertakozcan
Copy link
Author

That would be great, thanks!

@edvin
Copy link
Owner

edvin commented Jul 16, 2018

Sure thing. I will fix it later today :)

@edvin
Copy link
Owner

edvin commented Jul 17, 2018

Sorry about the delay. FXLauncher 1.0.20 should be in Maven Central shortly :)

@mertakozcan
Copy link
Author

No problem, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants