[GRADLE-3014] NPE when declared artifact uses file without extension Created: 04/Feb/14  Updated: 05/Mar/14  Resolved: 05/Feb/14

Status: Resolved
Project: Gradle
Affects Version/s: 1.10
Fix Version/s: 1.12-rc-1

Type: Bug
Reporter: Szczepan Faber Assignee: Szczepan Faber
Resolution: Fixed Votes: 0

Issue Links:
Duplicate
Duplicated by GRADLE-3040 Adding a custom artifact file without... Resolved

 Description   

Below snippet yields NPE during configuration of the project:

artifacts {
  //fails:
  archives file("foo")
  //ok:
  archives file("foo.txt")
}

//stack trace (Gradle 1.10):

* What went wrong:
A problem occurred evaluating root project 'quickstart'.
> java.lang.NullPointerException (no error message)

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'quickstart'.
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
	at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
	at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:507)
	at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
	at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
	at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
	at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
	at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
	at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
	at org.gradle.launcher.Main.doAction(Main.java:46)
	at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
	at org.gradle.launcher.Main.main(Main.java:37)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
	at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58)
Caused by: java.lang.NullPointerException
	at org.gradle.api.internal.plugins.DefaultArtifactPublicationSet.addCandidate(DefaultArtifactPublicationSet.java:41)
	at org.gradle.api.plugins.BasePlugin$3$1.execute(BasePlugin.java:147)
	at org.gradle.api.plugins.BasePlugin$3$1.execute(BasePlugin.java:145)
	at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
	at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:164)
	at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:159)
	at org.gradle.api.internal.DelegatingDomainObjectSet.add(DelegatingDomainObjectSet.java:80)
	at java_util_Set$add.call(Unknown Source)
	at org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler.pushArtifact(DefaultArtifactHandler.groovy:39)
	at org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler.this$2$pushArtifact(DefaultArtifactHandler.groovy)
	at org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler$_methodMissing_closure1.doCall(DefaultArtifactHandler.groovy:64)
	at org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler.methodMissing(DefaultArtifactHandler.groovy:63)
	at org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler.invokeMethod(DefaultArtifactHandler.groovy)
	at build_gqqua4471l24t98f7a8ai3qq3$_run_closure7.doCall(/Users/sfaber/gradle/tryouts/quickstart/build.gradle:53)
	at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)
	at org.gradle.api.internal.project.AbstractProject.artifacts(AbstractProject.java:926)
	at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:246)
	at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:134)
	at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
	at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
	at build_gqqua4471l24t98f7a8ai3qq3.run(/Users/sfaber/gradle/tryouts/quickstart/build.gradle:52)
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
	... 33 more

Generated at Wed Jun 30 12:37:33 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.