我应该在哪里把安装程序资源(WXS文件,DMG脚本,图标),以及如何部署自包含的应用程序时,配置的Maven antrun [英] where should i put installer resources (wxs file,dmg-script,icon) and how to configure maven antrun when deploying self contained app

查看:370
本文介绍了我应该在哪里把安装程序资源(WXS文件,DMG脚本,图标),以及如何部署自包含的应用程序时,配置的Maven antrun的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该在哪里使用antrun插件放弃我的自定义配置维克斯安装程序的配置文件和配置如何JavaFX的packger工具Maven的基于Java FX项目?我已经成功地使用默认的包资源取得基本MSI安装程序,它是工作的罚款。现在,我已经配置安装工人WXS文件作为创建MSI时使用的WiX工具集fxpackager底层。

Where should i drop my custom configured WIX installer configuration file and how to configured javafx packger tool in maven based java fx project using antrun plugin? I successfully have made basic MSI installer using default package resource and it is working fine. Now i have configured installers WXS files as fxpackager underlying is using wix toolset when creating MSI.

这<一个href=\"http://stackoverflow.com/questions/15880102/how-to-set-custom-icon-for-javafx-native-package-icon-on-windows\">How设置在Windows的JavaFX本地包图标自定义图标我必须设法添加图标。但部署任务不是捡即WXS自定义配置文件

using this Customizing MSI installer and this How to set custom icon for javafx native package icon on Windows i have manages to add Icon. but deploy task is not picking custom configuration file i.e WXS

我也阅读官方指南的http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html

我的项目结构看起来像这样

my project structure looks like this

您可以看到我有两个位置添加即在Java的客户端/包/窗/的
我也加入的src / main /部署/包/窗/的 的有关链接的问题提到。
但两种方式都无法与我的Maven插件蚂蚁工作。我的心是爆炸。

You can see i have added on both locations i.e under java-client/package/windows/. and i also added in src/main/deploy/package/windows/. as mentioned on linked questions. but both ways are not working with my maven ant plugin. my mind is exploding.

从Oracle文档,他们指出

包装工具寻找定制的资源类路径上恢复到内置的资源之前。在Java包装了。 (当前工作目录),默认添加到类路径中。因此,以取代应用程序图标,自定义图标复制到./package/macosx/DemoApp.icns从中javapackager在运行目录(通常,项目根目录)。

From Oracle documentation they states " Packaging tools look for customized resources on the class path before reverting to built-in resources. The Java Packager has "." (the current working directory) added to the class path by default. Therefore, to replace the application icon, copy your custom icon to ./package/macosx/DemoApp.icns in the directory from which javapackager is run (typically, the root project directory)."

我也试图在聚甲醛我的构建一部分

i also tried to add ${basedir} to ant class-path look at My build part of pom

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <includes>
                    <include>**/*Test.class</include>
                </includes>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <id>default-jar</id>
                    <phase>none</phase>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <id>create-temp-jar</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target xmlns:fx="javafx:com.sun.javafx.tools.ant">
                            <taskdef uri="javafx:com.sun.javafx.tools.ant" resource="com/sun/javafx/tools/ant/antlib.xml"
                                classpath="maven.plugin.classpath" />

                            <fx:jar
                                destfile="${project.build.directory}/${project.build.finalName}-temp">
                                <fx:application id="fxApp" name="${project.name}"
                                    mainClass="${exec.mainClass}" />
                                <fx:fileset dir="${project.build.directory}/classes" />
                                <manifest>
                                    <attribute name="Implementation-Vendor" value="${app.vendor}" />
                                    <attribute name="Implementation-Title" value="${app.name}" />
                                    <attribute name="Implementation-Version" value="1.0" />
                                </manifest>
                            </fx:jar>
                            <attachartifact
                                file="${project.build.directory}/${project.build.finalName}-temp.jar"
                                classifier="temp" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>create-deployment-bundle</id>
                    <phase>install</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target xmlns:fx="javafx:com.sun.javafx.tools.ant">
                            <property name="windows.basedir" value="${basedir}/src/main/deploy/package/windows" />
                            <property name="mac.basedir" value="${basedir}/package/macosx" />
                            <property name="my.basedir" value="${basedir}" />
                            <taskdef uri="javafx:com.sun.javafx.tools.ant" resource="com/sun/javafx/tools/ant/antlib.xml"
                                classpath="${my.basedir}:${windows.basedir}:${mac.basedir}" />

                            <fx:deploy nativeBundles="msi" width="600" height="400"
                                outdir="${dist.dir}" embedJNLP="true" outfile="${project.build.finalName}"
                                verbose="true">
                                <fx:application name="${project.build.finalName}"
                                    mainClass="${exec.mainClass}" />
                                <fx:preferences shortcut="true" menu="true"
                                    install="true" />
                                <fx:resources>
                                    <fx:fileset dir="${project.build.directory}"
                                        includes="${project.build.finalName}.jar" />
                                </fx:resources>
                                <fx:info title="${application.title}" vendor="${application.vendor}"
                                    copyright="${application.copyright}" description="Test built from Java executable jar">
                                    <fx:icon
                                        href="${basedir}/src/main/deploy/package/windows/${project.build.finalName}.ico" />
                                </fx:info>
                                <fx:platform javafx="${javafx.version}">
                                    <fx:jvmarg value="-Xms512m" />
                                    <fx:jvmarg value="-Xmx1024m" />
                                </fx:platform>
                                <fx:permissions elevated="true" />
                            </fx:deploy>
                        </target>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ant-javafx</artifactId>
                    <version>${javafx.version}</version>
                    <systemPath>${javafx.tools.ant.jar}</systemPath>
                    <scope>system</scope>
                </dependency>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>javafx</artifactId>
                    <version>${javafx.version}</version>
                    <systemPath>${fx.home}</systemPath>
                    <scope>system</scope>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <descriptors>
                    <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
                </descriptors>
                <finalName>${project.build.finalName}</finalName>
                <appendAssemblyId>false</appendAssemblyId>
                <archive>
                    <manifestEntries>
                        <JavaFX-Version>${javafx.version}</JavaFX-Version>
                        <JavaFX-Application-Class>${exec.mainClass}</JavaFX-Application-Class>
                        <Main-Class>com/javafx/main/Main</Main-Class>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

能否请你帮我搞清楚了problam。

Can you please please help me figuring out the problam.

推荐答案

这么多的尝试后终于我已经解决了我的问题,并帮助别人我在这里张贴的解决方案。

After so many tries finally i have resolved my issue and for helping others i am posting here the solution.

项目结构应该是这样的。

Project Structure should be like this

和的pom.xml应该b类似这样

and pom.xml should b like this

<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.client</groupId>
<artifactId>JavaClient</artifactId>
<version>5.2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JavaClient</name>

<properties>
    <exec.mainClass>com.client.MainApp</exec.mainClass>
    <javafx.version>2.2.67</javafx.version>
    <fx.home>${java.home}/lib/jfxrt.jar</fx.home>
    <javafx.tools.ant.jar>${java.home}/../lib/ant-javafx.jar</javafx.tools.ant.jar>
    <javafx-dialogs.jar>${project.basedir}/lib/javafx-dialogs-0.0.1.jar</javafx-dialogs.jar>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <dist.dir>${project.build.directory}/diploy</dist.dir>
    <base.dir>${project.basedir}</base.dir>
</properties>

<dependencies>
    <dependency>
        <groupId>org.oracle</groupId>
        <artifactId>javafx</artifactId>
        <version>${javafx.version}</version>
        <systemPath>${fx.home}</systemPath>
        <scope>system</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>xmlpull</groupId>
        <artifactId>xmlpull</artifactId>
        <version>1.1.3.1</version>
    </dependency>

    <dependency>
        <groupId>xpp3</groupId>
        <artifactId>xpp3_min</artifactId>
        <version>1.1.4c</version>
    </dependency>

    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.7</version>
    </dependency>

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>javafx-dialogs</artifactId>
        <version>0.0.1</version>
        <scope>system</scope>
        <systemPath>${javafx-dialogs.jar}</systemPath>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.0.2</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <includes>
                    <include>**/*Test.class</include>
                </includes>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>create-temp-jar</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target xmlns:fx="javafx:com.sun.javafx.tools.ant">
                            <taskdef uri="javafx:com.sun.javafx.tools.ant" resource="com/sun/javafx/tools/ant/antlib.xml"
                                classpath="${project.basedir}:${javafx.tools.ant.jar}:${fx.home}" />

                            <fx:jar
                                destfile="${project.build.directory}/${project.build.finalName}-temp">
                                <fx:application id="fxApp" name="${project.name}"
                                    mainClass="${exec.mainClass}" />
                                <fx:fileset dir="${project.build.directory}/classes" />
                                <manifest>
                                    <attribute name="Implementation-Vendor" value="${app.vendor}" />
                                    <attribute name="Implementation-Title" value="${app.name}" />
                                    <attribute name="Implementation-Version" value="1.0" />
                                </manifest>
                            </fx:jar>
                            <attachartifact
                                file="${project.build.directory}/${project.build.finalName}-temp.jar"
                                classifier="temp" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>create-deployment-bundle</id>
                    <phase>install</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target xmlns:fx="javafx:com.sun.javafx.tools.ant">

                            <taskdef uri="javafx:com.sun.javafx.tools.ant" resource="com/sun/javafx/tools/ant/antlib.xml"
                                classpath="${project.basedir}:${javafx.tools.ant.jar}:${fx.home}" />

                            <fx:deploy nativeBundles="all" width="100" height="100"
                                outdir="${dist.dir}" embedJNLP="true" outfile="${project.build.finalName}"
                                verbose="true">

                                <fx:application name="${project.build.finalName}"
                                    mainClass="${exec.mainClass}" />
                                <fx:resources>
                                    <fx:fileset dir="${project.build.directory}" includes="${project.build.finalName}.jar" />
                                </fx:resources>
                                <fx:info title="${project.build.finalName}" vendor="NUAXIS"
                                    description="Test built from Java executable jar" />

                                <fx:permissions elevated="true" />
                            </fx:deploy>
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <descriptors>
                    <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
                </descriptors>
                <finalName>${project.build.finalName}</finalName>
                <appendAssemblyId>false</appendAssemblyId>
                <archive>
                    <manifestEntries>
                        <JavaFX-Version>${javafx.version}</JavaFX-Version>
                        <JavaFX-Application-Class>${exec.mainClass}</JavaFX-Application-Class>
                        <Main-Class>com/javafx/main/Main</Main-Class>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

现在我将解释我的错误。仔细一看问题的构建的一部分。蚂蚁运行插件,当我们去外汇:部署在这里的任务,你会发现我有类路径条目。我搞砸了这部分这是如此简单。现在看在我这里出海。类路径现在更新。首先我提到基本目录,然后再ANT-FX-插件路径jfxrt.jar路径。 jfxrt可以是没有必要的。在这之后我已删除的插件的依赖关系部分。这是至关重要的。如果我不删除此节,然后我antrun插件alwasy看看行家提供的依赖,但不是在蚁类路径中。在蚁类路径顺序是非常非常重要的。你必须BASEDIR蚂蚁run.jar之前总会来。多数民众赞成它

Now I will explain you my mistake. closely look the build part of Question. in ant-run plugin when we go in fx:deploy task here you find that i have entry of class-path. i messed up this part which was so simple. look now in my Pom here. class path now updated. first i mention the base dir then ant-fx-plugin path then jfxrt.jar path. jfxrt may be not necessary. after this i have removed dependencies section of plugin. this is critical. if i do not remove this section then my antrun plugin alwasy look into maven provided dependencies but not in ant-classpath. in ant-classpath order is very very important. your basedir must always come before ant-run.jar . thats it

希望这将对于谁将会面对这个问题的人有所帮助。

Hope This will helpful for the persons who will face this issue.

这篇关于我应该在哪里把安装程序资源(WXS文件,DMG脚本,图标),以及如何部署自包含的应用程序时,配置的Maven antrun的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆