Missing Artifact Extension Error Not Descriptive


(stardolphin) #1

If you specify an artifact without an extension (and it cannot be auto-detected), you get a null pointer (AbstractArtifact.hashcode) out of Ivy. Worse, it happens when you resolve upstream projects, so the error message is on a different project than the artifact is specified in. It might be worth it to add more information (particularly, what artifact is causing the issue), to make the error less obtuse and easier to find.

// This will error when another project tries to depend on this project, with a stacktrace that is hard to track back to this line
File artifact = new File(project.projectDir, "FAKEARTIFACT");
if(!artifact .exists()) { artifact .createNewFile()}
artifacts {
   archives(file: artifact, name: 'fakeartifact', type: 'type')
}

The same issue happens if you have extension and omit type. Even something simple as ‘artifact fakeartifact is missing extension’ or ‘artifact fakeartifact on someproject is misconfigured’ would make it a lot clearer.


#2

Thanks for the report. I’m working on the new publication DSL at the moment and have a test that demonstrates the problems publishing and resolving artifacts without an extension. Needless to say, having a failing test means that we’re pretty certain to fix the problem!