[英]javafx-maven-plugin mac pkg installer does not show app icon
I use the following maven plugin configuration on my mac to generate the native installers. 我在Mac上使用以下maven插件配置来生成本机安装程序。
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.5.0</version>
<configuration>
<appName>${project.name}</appName>
<title>${project.name}</title>
<description>${project.description}</description>
<vendor>example</vendor>
<certCountry>com</certCountry>
<mainClass>${mainClass}</mainClass>
<needMenu>true</needMenu>
<additionalAppResources>src/main/deploy/package/all</additionalAppResources>
<bundleArguments>
<icon.ico>src/main/resources/icons/Icon.ico</icon.ico>
<icon.png>src/main/resources/icons/Icon_32.png</icon.png>
<icon.icns>src/main/resources/icons/Icon.icns</icon.icns>
</bundleArguments>
<jfxMainAppJarName>${project.build.finalName}.jar</jfxMainAppJarName>
</configuration>
</plugin>
The Example.app folder and the Example.dmg installer both show the correct app icon, but the Example.pkg installer shows the plain java jar image (1). Example.app文件夹和Example.dmg安装程序都显示正确的应用程序图标,但是Example.pkg安装程序显示纯Java jar图像(1)。 How can change that image (1)? 如何更改该图像(1)?
Is it possible to change the small icon in the title bar (2) as well? 是否可以更改标题栏(2)中的小图标?
The folder structure of my project: 我的项目的文件夹结构:
I tried with Oracle Java JDK 8 Update 40 and Update 101 (64bit) 我尝试使用Oracle Java JDK 8 Update 40和Update 101(64位)
See also: javafx-maven-plugin#224 另请参阅: javafx-maven-plugin#224
To make it dedundant, I'm pasting the answer here too: 为了使它显得多余,我也在这里粘贴了答案:
Hi there, 嗨,您好,
this is no bug, it is "just" undocumented (seems there are a lot of people who know this, or very few people who use this feature). 这不是错误,只是“没有”记载(似乎有很多人知道这一点,或者很少有人使用此功能)。
Please see the getConfig_BackgroundImage
-method: 请参见getConfig_BackgroundImage
方法:
https://github.com/teamfx/openjfx-8u-dev-rt/blob/fd634925571310284b02d89ff512552e795ba5e8/modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacPkgBundler.java#L192 https://github.com/teamfx/openjfx-8u-dev-rt/blob/fd634925571310284b02d89ff512552e795ba5e8/modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacPkgBundler.java#L192
private File getConfig_BackgroundImage(Map<String, ? super Object> params) {
return new File(CONFIG_ROOT.fetchFrom(params), APP_NAME.fetchFrom(params) + "-background.png");
}
Please create some image and place it below src/main/deploy/package/macosx
, it has to be PNG-fileformat. 请创建一些图片并将其放置在src/main/deploy/package/macosx
,该图片必须为PNG文件格式。 This file should be named ${project.name}-background.png
to get fetched by the bundler. 该文件应命名为${project.name}-background.png
以便由捆绑程序获取。
This should have been printed out to you while having <verbose>
set to true
. 当<verbose>
设置为true
时,应该已经向您输出了此内容。
General advice: turn VERBOSE-switch on ;) the packager itself behaves different (like not removing the temporary created working-folder, making it possible to further adjust your stuff) and prints out more important debugging-stuff. 一般建议:打开VERBOSE开关;)打包程序本身的行为有所不同(例如不删除临时创建的工作文件夹,从而可以进一步调整内容),并打印出更重要的调试信息。
The verbose-hint is even mentioned in the official documentation: https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGHHDGC 甚至在官方文档中也提到了详细提示: https : //docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGHHDGC
Late reply, but if you still wonder how to change the small icon in the title bar (2) you can do that simply by right-clicking
the pkg-file
and choose Get Info
in the menu, then you simply drag-and-drop
your .icns-file
on top of the current one next to the pkg name. 回复较晚,但是如果您仍然想知道如何更改标题栏中的小图标(2),只需right-clicking
pkg-file
并在菜单中选择“ Get Info
”即可,然后只需drag-and-drop
您的.icns-file
位于pkg名称旁边当前.icns-file
的顶部。 This will change the pkg-icon and what is shown in the title bar during installation. 这将更改pkg-icon以及安装过程中标题栏中显示的内容。 This does not appear to break the product signature either which is good, see picture below... 这似乎也没有破坏产品签名,这很好,请参见下图...
To verify signature still holds after icon change: 要验证图标更改后签名是否仍然有效:
spctl -a -v --type install MyAppName-1.0.pkg
MyAppName-1.0.pkg: accepted
source=Developer ID
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.