beryx-gist / badass-runtime-example

Usage example of the Badass Runtime Plugin
Apache License 2.0
3 stars 6 forks source link

After creating a JPackage this file logback.xml missing #1

Closed harideva16 closed 3 years ago

harideva16 commented 3 years ago

I copy and paste this logback.xml file using the following code.

tasks.runtime.doLast {
copy {
    from('src/main/resources')
    into("$buildDir/image/bin")
}
}

But , after creating a JPackage the file missing.

IN APP.cfg file

 java-options=-'-Dlogback.configurationFile=$APPDIR\..

But , there is no file in that path.

How to bundle my file with JPackage ?

siordache commented 3 years ago

I updated this example project. Use this:

tasks.jpackage.doLast {
    copy {
        from('src/main/resources')
        into("$buildDir/jpackage/$project.name/app")
    }
}
harideva16 commented 3 years ago

I am using id 'org.beryx.runtime' version '1.12.5'

the following code not worked .

tasks.jpackage.doLast {
copy {
    from('src/main/resources')
    into("$buildDir/jpackage/$project.name/app")
}
}

If I use id 'org.beryx.runtime' version '1.12.3' the following code works only in windows.

tasks.jpackageImage {
doLast {
    copy {
         from('src/main/resources')
        into "$jpackageData.imageOutputDir/$jpackageData.imageName"
    }
}
}

in cfg file

 java-options=-'-Dlogback.configurationFile=$APPDIR\..

This code not worked in linux and mac.

How to bundle my file with JPackage ?

I want to do this in windows , linux and mac ?

How can I do this ?

siordache commented 3 years ago

See this answer: https://github.com/beryx/badass-runtime-plugin/issues/89#issuecomment-912610231

harideva16 commented 3 years ago

See this answer: beryx/badass-runtime-plugin#89 (comment)

I am using github actions to create jpackage.

I download JPackage from github actions recently you did in this project : https://github.com/beryx-gist/badass-runtime-example/actions/runs/1198181759

Then,I installed in my windows 10 os . But , there is no logback.xml file in JPackage.

s1 inside app folder logback.xml file missing s2

I want my file inside installation folder for all the following os.

  1. Windows,
  2. Linux and
  3. mac.

How can I do this ?

siordache commented 3 years ago

You're right. It should be doFirst instead of doLast: https://github.com/beryx-gist/badass-runtime-example/blob/1ed0cda3de3ff56a303f483a1609065ad0aab8e3/build.gradle#L43-L48

I fixed the example: https://github.com/beryx-gist/badass-runtime-example/actions/runs/1200701206#artifacts

harideva16 commented 3 years ago

You're right. It should be doFirst instead of doLast: https://github.com/beryx-gist/badass-runtime-example/blob/1ed0cda3de3ff56a303f483a1609065ad0aab8e3/build.gradle#L43-L48

I fixed the example: https://github.com/beryx-gist/badass-runtime-example/actions/runs/1200701206#artifacts

I have three devices with windows , linux and mac operating systems.

I tested all JPackages in my devices.

this code worked only in windows JPackage.

But, In linux and Mac logback.xml file missing in JPACKAGE.

siordache commented 3 years ago

Damn, you're right again 😃

I hope this change fixes the issue: https://github.com/beryx-gist/badass-runtime-example/blob/13b68668869d19ca5a01c2912dfeb873ba6158a1/build.gradle#L48-L55

Here the updated images: https://github.com/beryx-gist/badass-runtime-example/actions/runs/1201455602#artifacts

I tested only the msi and deb installers. Please check whether the other installers also work.

harideva16 commented 3 years ago

I create a JPackage with github actions with myproject.

I tested all JPackages in my devices.

But , this code worked only in windows JPackage.

In linux and Mac logback.xml file missing in JPACKAGE.

This code not worked.

Damn, you're right again 😃

I hope this change fixes the issue: https://github.com/beryx-gist/badass-runtime-example/blob/13b68668869d19ca5a01c2912dfeb873ba6158a1/build.gradle#L48-L55

Here the updated images: https://github.com/beryx-gist/badass-runtime-example/actions/runs/1201455602#artifacts

I tested only the msi and deb installers. Please check whether the other installers also work.

siordache commented 3 years ago

I updated the GitHub Actions to show the logback files contained in the generated packages. As you can see in the logs, logback.xml is definitely there.

Excerpt from the ubuntu-latest job:

Show logback files in DEB package

dpkg -c build/jpackage/*.deb | grep logback
-rw-r--r-- root/root    290339 2021-09-05 13:22 ./opt/non-modular-hello/lib/app/logback-classic-1.2.3.jar
-rw-r--r-- root/root    471901 2021-09-05 13:22 ./opt/non-modular-hello/lib/app/logback-core-1.2.3.jar
-rw-r--r-- root/root       437 2021-09-05 13:22 ./opt/non-modular-hello/lib/app/logback.xml

Show logback files in RPM package

rpm -qlp build/jpackage/*.rpm | grep logback
/opt/non-modular-hello/lib/app/logback-classic-1.2.3.jar
/opt/non-modular-hello/lib/app/logback-core-1.2.3.jar
/opt/non-modular-hello/lib/app/logback.xml

Excerpt from the macOS-latest job:

Show logback files in DMG package

hdiutil attach build/jpackage/*.dmg && find /Volumes/non-modular-hello/non-modular-hello.app/Contents -name "logback*"
/Volumes/non-modular-hello/non-modular-hello.app/Contents/app/logback-classic-1.2.3.jar
/Volumes/non-modular-hello/non-modular-hello.app/Contents/app/logback-core-1.2.3.jar
/Volumes/non-modular-hello/non-modular-hello.app/Contents/app/logback.xml

Since logback.xml has been included in all packages, I think we can close this issue. In this example project, logback.xml is no longer missing.

If logback.xml is still missing in your project, please create a new issue. However, I cannot help you unless you also put your project (or an SSCCE) on GitHub.

siordache commented 3 years ago

I think I know why you thought that logback.xml is still missing: the system property logback.configurationFile in the applicationDefaultJvmArgs pointed to the wrong location. The correct value is: https://github.com/beryx-gist/badass-runtime-example/blob/ae7ac75912ac0f00c3c57ba0b8a5ba09be1c5a00/build.gradle#L21

harideva16 commented 3 years ago

I think I know why you thought that logback.xml is still missing: the system property logback.configurationFile in the applicationDefaultJvmArgs pointed to the wrong location. The correct value is: https://github.com/beryx-gist/badass-runtime-example/blob/ae7ac75912ac0f00c3c57ba0b8a5ba09be1c5a00/build.gradle#L21

It worked. thank you.