Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
理解maven中的目标执行器_Maven_Javafx 8_Maven 3_Exec Maven Plugin - Fatal编程技术网

理解maven中的目标执行器

理解maven中的目标执行器,maven,javafx-8,maven-3,exec-maven-plugin,Maven,Javafx 8,Maven 3,Exec Maven Plugin,我正在尝试使用fxlauncher为JavaFX8应用程序创建本机安装程序,如中所述 在示例提供的pom.xml中,我不理解执行embed manifest In launcher在做什么 问题:有人能解释一下那里发生了什么吗 第一次执行是直接执行的,它指定了一个java类,该类具有main方法并提供了参数 <execution> <id>create-manifest</id> <phase>package</phase&g

我正在尝试使用fxlauncher为JavaFX8应用程序创建本机安装程序,如中所述

在示例提供的
pom.xml
中,我不理解执行
embed manifest In launcher
在做什么

问题:有人能解释一下那里发生了什么吗

第一次执行是直接执行的,它指定了一个java类,该类具有main方法并提供了参数

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

创建清单
包裹
JAVA
fxlauncher.CreateManifest
${app.url}
${app.mainClass}
${app.dir}
在启动器中嵌入清单
包裹
执行官
罐子
${app.dir}
超滤
fxlauncher.jar
app.xml

执行上方的注释已经提供了第一个提示:

将app.xml嵌入到fxlauncher.xml中,这样我们就不需要引用app.xml来启动应用程序

executable
配置条目设置为
jar
,因此它将运行
jar
命令

然后将参数
uf
传递给它,从命令中我们可以看到:

-u update existing archive
-f specify archive file name
因此,
f
选项也需要一个参数,它实际上是
fxlauncher.jar
条目

因此,将执行的完整命令为:

jar uf fxlauncher.jar app.xml
它将更新现有的和提供的
fxlauncher.jar
文件,并将其添加到
app.xml
文件中,如上面的注释所示


这样的执行绑定到带有packaging
jar
的项目中的
package
阶段(因此无需指定),这将在该阶段的打包之后执行(例如Maven jar插件)。因此,构建将首先创建/打包jar文件,然后运行这些执行来更改/更新它。

pom.xml中发生了很多“神奇”的事情,但由于将被称为“javapackager”,我建议使用maven进行JavaFX开发。例如项目,请看一看。免责声明:我是maven插件的维护者。@FibreFoX我能够使用您指定的插件构建安装程序。但是我无法设置jnlp输出文件名。这是问题的链接,关于这个问题,我提供了一个解决方案;)谢谢你的详细解释