Artifact upload without file extension

I’m trying to upload a binary artifact that doesn’t have a file extension via maven uploadArchives mavenDeployer.

def myfile = file('build/myfile')
  artifacts {
    archives file: myFile, name: 'myFile', type: 'exe', builtBy: build
}

However it doesn’t seem to like ‘myfile’ without a file extension I get the following error:.

* What went wrong:
Execution failed for task ':uploadArchives'.
> Could not publish configuration ':archives'.
   > java.lang.NullPointerException (no error message)

If I rename it to ‘myfile.exe’ everything works as expected.

Is there a way to get maven to upload the file without an extension, or is this just not how maven is suppose to work? I tried type ‘uexe’ but that didn’t work.

Is there a way to get add a Maven plugin? http://mojo.codehaus.org/maven-native/native-maven-plugin/usage.html

Thanks, Matt

Please run with ‘-s’ and post the stack trace. I don’t understand what your last question is about.

hi Peter,

It’s same with

http://forums.gradle.org/gradle/topics/artifact_configuration_w_o_file_extension_creates_nullpointerexception. I also encounter this problem today.

here is a demo which can be used to reproduce this problem:

  [zouguangxian@]$ ls  Readme  build.gradle  
  [zouguangxian@]$ cat build.gradle

apply plugin: 'java'  configurations {



dist  }

 artifacts {



dist file('Readme')  }  
  [zouguangxian@]$ gradle -s build

 FAILURE: Build failed with an exception.

 * Where:  Build file '/Users/zouguangxian/tmp/gradle/build.gradle' line: 7

 * What went wrong:  A problem occurred evaluating root project 'gradle'.  > 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 'gradle'.

at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)

at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:132)

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.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)

at org.gradle.util.Swapper.swap(Swapper.java:38)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)

at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)

at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:36)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)

at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)

at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)

at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)

at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)

at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)  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$0.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_tij88lc0ll7rovej5lts20g6f$_run_closure2.doCall(/Users/zouguangxian/tmp/gradle/build.gradle:7)

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_tij88lc0ll7rovej5lts20g6f.run(/Users/zouguangxian/tmp/gradle/build.gradle:6)

at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)

... 53 more



BUILD FAILED

 Total time: 1.051 secs  [zouguangxian@]$

In gradle-1.9/subprojects/plugins/src/main/groovy/org/gradle/api/internal/plugins/DefaultArtifactPublicationSet.java

public void addCandidate(PublishArtifact artifact) {
        if (defaultArtifact == null) {
            artifacts.add(artifact);
            defaultArtifact = artifact;
            return;
        }
          String thisType = artifact.getType();
        String currentType = defaultArtifact.getType();
        if (thisType.equals("ear")) {
            replaceCurrent(artifact);
        } else if (thisType.equals("war")) {
            if (currentType.equals("jar")) {
                replaceCurrent(artifact);
            }
        } else if (!thisType.equals("jar")) {
            artifacts.add(artifact);
        }
    }

when getType() return null will cause java.lang.NullPointerException, so that If the type is given for the file, the problem will be resolved.

  apply plugin: ‘java’  configurations {

dist }

artifacts {

dist file: file(‘Readme’), type: ‘binary’ }