我正在尝试创建exe文件的图标,同时创建javafx包装的本机捆绑.
我尝试将图标添加到pom.xml中,但直到它不会为我工作,因为它提供了默认图标
使用包含Pom.xml的Intellij IDEA IDE,通过command = mvn jfx:build-native创建包
这是我的pom.xml:
我尝试将图标添加到pom.xml中,但直到它不会为我工作,因为它提供了默认图标
使用包含Pom.xml的Intellij IDEA IDE,通过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>
我在pom.xml中添加了一个图标路径${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>
但它不会工作..
我只是使用Zonsky的优秀javafx-maven-plugin来解决同样的问题.从您使用的1.5版本开始,src / main / deploy目录将添加到类路径中.您可以在那里添加要使用的图标,它将在本机构建器的类路径中可用!
我在那里添加了src / main / deploy / package / windows / myapp.ico,它终于工作了:)
为你:
>创建src / main / deploy / package / windows /文件夹
>添加名称为${project.build.finalName} .ico的图标
>运行mvn jfx:build-native
我没有广泛使用它 – 只是让它工作并想分享.所以如果你想使用不同名称的图标,我不知道如何.至少还没有. < icon> …< / icon>配置部分中的部分似乎是针对webstart的,所以我没有使用它.希望你能开始工作!