了解 Maven 中的目标执行程序
understanding goal exec in maven
我正在尝试使用 fxlauncher 为 javafx 8 应用程序创建本机安装程序,如 http://fxldemo.tornado.no/
中所述
在pom.xml
提供的例子中,我不明白执行embed-manifest-in-launcher
是做什么的。
问题:有人可以解释一下那里发生了什么吗?
第一次执行很直接,它指定了一个 java class,其中有 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>
执行上方的评论已经提供了第一个提示:
Embed app.xml inside fxlauncher.xml so we don't need to reference app.xml to start the app
executable
配置项设置为 jar
,因此它将 运行 jar
命令。
然后会传给它参数uf
,从jar help命令我们可以看出:
-u update existing archive
-f specify archive file name
因此,f
选项也需要一个参数,它确实是 fxlauncher.jar
条目。
因此,将要执行的完整命令为:
jar uf fxlauncher.jar app.xml
这将根据上面的评论更新现有的和提供的 fxlauncher.jar
文件添加到 app.xml
文件。
这样的执行绑定到项目中的 package
阶段,包装 jar
(default one, hence no need to specify it), which will be executed after the default bindings 到这个阶段的包装(例如 Maven Jar 插件) . 因此构建将首先 create/package jar 文件,然后 运行 这些执行到 change/update 它。
我正在尝试使用 fxlauncher 为 javafx 8 应用程序创建本机安装程序,如 http://fxldemo.tornado.no/
中所述在pom.xml
提供的例子中,我不明白执行embed-manifest-in-launcher
是做什么的。
问题:有人可以解释一下那里发生了什么吗?
第一次执行很直接,它指定了一个 java class,其中有 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>
执行上方的评论已经提供了第一个提示:
Embed app.xml inside fxlauncher.xml so we don't need to reference app.xml to start the app
executable
配置项设置为 jar
,因此它将 运行 jar
命令。
然后会传给它参数uf
,从jar help命令我们可以看出:
-u update existing archive
-f specify archive file name
因此,f
选项也需要一个参数,它确实是 fxlauncher.jar
条目。
因此,将要执行的完整命令为:
jar uf fxlauncher.jar app.xml
这将根据上面的评论更新现有的和提供的 fxlauncher.jar
文件添加到 app.xml
文件。
这样的执行绑定到项目中的 package
阶段,包装 jar
(default one, hence no need to specify it), which will be executed after the default bindings 到这个阶段的包装(例如 Maven Jar 插件) . 因此构建将首先 create/package jar 文件,然后 运行 这些执行到 change/update 它。