[GRADLE-2969] Unobvious NPE thrown when using null as a dependency notation Created: 28/Nov/13  Updated: 28/Nov/13  Resolved: 28/Nov/13

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.11-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Luke Daley
Resolution: Fixed Votes: 0

Known Issue Of:

dependencies {
  compile null

Produces an infrastructure level NPE. This can happen in the real world when notations come from a central map as is common practice.

Comment by Gradle Forums [ 28/Nov/13 ]

I don't quite follow what happened. Can you expand a little bit please, perhaps with some examples.

Comment by Gradle Forums [ 28/Nov/13 ]

This is easy to reproduce.

I have a multiproject, and I define all libraries we are depending on in a separate file that looks like this:

ext.libraries = [
activeIO_core : 'org.apache.activemq:activeio-core:3.1.2',
jms_api : 'javax.jms:jms:1.1',

Now, a subproject got a new dependency on jms_api; so in the build file for this subproject I declared:

dependencies {
compile (libraries.commons_collections, libraries.jsm_api,libraries.activeMQ_core)

Please notice the typo "jsm_api" instead of "jms_api"! This caused the reported NPE.

So, my expectation is: Gradle sees the invalid symbolic name and reports it as invalid instead of running into the reported NPE.

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