在创建javafx打包的本机捆绑时,我正在尝试尝试使用exe文件的图标。我尝试将图标添加到pom.xml中,但直到它对我来说行不通,因为它提供了默认图标。
使用Intellij,其中包含一个Pom.xml,通过command = mvn jfx:build-native创建一个包,这里是我的pom.xml
<build>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<mainClass>com.demoApp.testapp.testApplication</mainClass>
<!-- only required if signing the jar file -->
<keyStoreAlias>example-user</keyStoreAlias>
<keyStorePassword>example-password</keyStorePassword>
<permissions>
<permission>all-permissions</permission>
</permissions>
<icon>${basedir}/src/main/resources/images/logoIcon.ico</icon>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>我已经在${basedir}/src/main/resources/images/logoIcon.ico中添加了一个图标路径,它将在本机包执行时运行,但是它不会对我起作用。
还有别的办法吗?请建议一下。
我使用ant在pom.xml中尝试了fx标记,下面是我在pom.xml中的更改
<properties>
<javafx.tools.ant.jar>${env.JAVA_HOME}\lib\ant-javafx.jar</javafx.tools.ant.jar> </properties>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>create-launcher-jar</id>
<phase>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="${javafx.tools.ant.jar}"/>
<fx:application id="fxApp"
name="${project.name}"
mainClass="com.precisionhawk.flightplanner.FlightPlannerApp"/>
<fx:jar destfile="${project.build.directory}/${project.build.finalName}-launcher">
<fx:application refid="fxApp"/>
<fx:fileset dir="${project.build.directory}/classes"/>
</fx:jar>
<attachartifact file="${project.build.directory}/${project.build.finalName}-launcher.jar"
classifier="launcher"/>
<fx:deploy>
<fx:info>
<fx:icon href="${basedir}/src/main/deploy/logoIcon.ico"></fx:icon>
</fx:info>
</fx:deploy>
</target>
</configuration>
</execution>
</executions>
</plugin>但不会成功的..。
发布于 2013-05-10 07:23:24
我只是在使用Zonsky的出色的javafx插件来解决同样的问题。从您也使用的1.5版本开始,src/main/部署目录将被添加到类路径中。您想要使用的图标可以添加到那里,它将在本机构建器的类路径上可用!
我在那里添加了src/main/部署/package/windows/myapp.ico,它最终成功了:)
对你来说:
src/main/deploy/package/windows/文件夹${project.build.finalName}.ico的图标mvn jfx:build-native我没有广泛地玩它-只是让它工作,并想要分享。所以如果你想用不同名字的图标,我不知道怎么用。至少现在还没有。配置部分中的<icon>...</icon>部分似乎是用于webstart的,因此我没有使用它。希望你能让它开始工作!
发布于 2013-04-10 11:45:45
在构建本地应用程序时,您需要查看日志记录。这将告诉您安装程序在哪里查找图标文件,并使用wich名称。对于默认的Windows本机应用程序,它在./package/windows/ 'appname‘..ico中无法记住’appname‘来自何处,但只需在构建时查看日志记录,它就会告诉您。(我使用从pom调用的Ant目标)
发布于 2019-08-21 07:40:20
you can do this:
`<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.8.3</version>
<configuration>
<vendor>YourCompany</vendor>
<mainClass>com.alan344.MapperGenApplication</mainClass>
<appName>mybatis-friend</appName>
<bundleArguments>
<icon>${project.basedir}/src/main/resources/image/icon.ico</icon>
</bundleArguments>
</configuration>
</plugin>`https://stackoverflow.com/questions/15880102
复制相似问题