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 133 forks source link

Default gradle builds broken? - possibly scripts null #213

Closed ryanhamilton closed 2 years ago

ryanhamilton commented 2 years ago

I'm submitting a…

Short description of the issue/suggestion: Building even simplest project in latest gradle seems broken.

Steps to reproduce the issue/enhancement:

  1. git clone https://github.com/ryanhamilton/buildbroken
  2. cd buildbroken
  3. gradlew package

THis has the simplest possible modern gradle config. i.e.

buildscript {
    repositories {         mavenCentral()     }
    dependencies {         classpath 'io.github.fvarrui:javapackager:1.6.6'     }
}

apply plugin: 'io.github.fvarrui.javapackager.plugin'
javapackager {     mainClass = 'gdemo.App' }

I know if I add a specific task, that will provide the script defaults etc. and will work but that wasn't what I expected to happen. Should it be?

What is the expected behavior?

Works.

What is the current behavior?

Caused by: java.lang.NullPointerException                                                                            
        at io.github.fvarrui.javapackager.packagers.Packager.copyAdditionalResources(Packager.java:223)              
        at io.github.fvarrui.javapackager.packagers.Packager.createApp(Packager.java:393)                            
        at io.github.fvarrui.javapackager.gradle.AbstractPackageTask.doPackage(AbstractPackageTask.java:45)          
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)                                        
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)      
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)        
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)        
        at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:242)                       

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

PackagerSettings [outputDirectory=F:\dev2\XXXXXXXXXXXXXXXXXXXX, licenseFile=null, iconFile=null, generateInstaller=false, mainClass=XXXXXXXXXXXXXXXXX, name=server, displayName=server, version=0.1, description=server, url=null, administratorRequired=false, organizationName=ACME, organizationUrl=, organizationEmail=, bundleJre=false, customizedJre=true, jrePath=null, jdkPath=C:\Program Files\Java\jdk1.8.0_211\jre, additionalResources=[], modules=[], additionalModules=[], platform=windows, envPath=null, vmArgs=[], runnableJar=null, copyDependencies=false, jreDirectoryName=jre, winConfig=WindowsConfig [icoFile=null, headerType=gui, companyName=ACME, copyright=ACME, fileDescription=server, fileVersion=1.0.0.0, internalName=server, language=null, originalFilename=server.exe, productName=server, productVersion=1.0.0.0, trademarks=null, txtFileVersion=0.1, txtProductVersion=0.1, disableDirPage=true, disableProgramGroupPage=true, disableFinishedPage=true, disableRunAfterInstall=true, disableWelcomePage=true, createDesktopIconTask=true, generateSetup=true, generateMsi=true, generateMsm=false, msiUpgradeCode=5ca02ef4-4234-41b4-a8c4-92fad9bfecb7, wrapJar=true, setupLanguages={english=compiler:Default.isl, spanish=compiler:Languages\Spanish.isl}, setupMode=installForAllUsers, signing=null, registry=Registry [entries=[]], removeOldLibs=false, exeCreationTool=launch4j, vmLocation=null], linuxConfig=null, macConfig=null, createTarball=false, createZipball=false, extra={}, useResourcesAsWorkingDir=true, assetsDir=F:\dev2\sqldash3\server\assets, classpath=null, jreMinVersion=null, manifest=Manifest [additionalEntries={}, sections=[]], additionalModulePaths=[], fileAssociations=null, packagingJdk=null, scripts=null]

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

Please tell us about your environment:

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

fvarrui commented 2 years ago

Hi @ryanhamilton!

Yes, there's a bug in the default task for Gradle, sorry! scripts property initialization is missing. I've just fixed in JavaPackager 1.6.7-SNAPSHOT branch issue-213. Please, try it and give me some feddback, thanks!

PS: since 1.6.7 is a SNAPSHOT version, you have to install it manually to your local repo. There are instructions in README.

fvarrui commented 2 years ago

Branch issue-213 merged into devel.

fvarrui commented 2 years ago

JavaPackager v1.6.7 released to Maven Central. See changes here.