fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 134 forks source link

Upgrading to 1.7.6 broke icons on Windows #436

Open dkoding opened 1 month ago

dkoding commented 1 month ago

I'm submitting a…

Short description of the issue/suggestion:

After upgrading to 1.7.6 from 1.6.6 winConfig.icoFile no longer works

Steps to reproduce the issue/enhancement:

I use the following config in both cases

def basePackageConfig = {
    mainClass = project.mainClassName
    bundleJre = true
    generateInstaller = false
    createZipball = true
    administratorRequired = false
    runnableJar = file('build/libs/' + applicationName + '-' + appVersion + '-obfuscated.jar')
    assetsDir = file('src/main/resources')
    licenseFile = file("LICENSE.txt")
    platform = io.github.fvarrui.javapackager.model.Platform.windows
    copyDependencies = false

    winConfig {
        headerType = HeaderType.gui
        wrapJar = true
        generateSetup = false
        generateMsm = false
        generateMsi = false
        icoFile = file('src/main/resources/'+applicationName+'.ico')
    }
}

What is the expected behavior?

The icon file should be placed in directory /build/applicationName/applicationName.ico and assigned to the .exe file

What is the current behavior?

No icon file in directory /build/applicationName/applicationName.ico and the .exe file has the coffee cup icon.

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

In 1.7.6 i get the current message:

Resolving resources ...
    License file found: C:\work\ragnarok\desktop\LICENSE.txt
    Icon file resolved: C:\work\ragnarok\desktop\src\main\resources\PuzzlePlayer.ico
    Skipped adding the icon file as additional resource because the target platform is Windows
    Effective additional resources [C:\work\ragnarok\desktop\LICENSE.txt]
Resources resolved!

In 1.6.6 the icon file is NOT skipped.

The icon IS updated in the launch4j directory - as app.ico

What is the motivation / use case for changing the behavior?

It does not work as-is.

Please tell us about your environment:

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

fvarrui commented 1 month ago

Hi @dkoding! This is probably a misunderstanding. ICO file is merged as EXE metadata, so there's no need to copy into apps folder.

    Skipped adding the icon file as additional resource because the target platform is Windows

It just warns you that the ICO file is not going to be copied as an additional resource, next to your EXE. If you need to distribute your ICO file next to your EXE, you should take a look at additionalResources property.

And if the problem is that, after change your ICO and rebuild your app, EXE is still showing the previous icon, this is caused by Windows Explorer cache. A quick trick if so: kill explorer.exe and start it again.