Error importing project that uses java and maven plugins

According to Xavier Ducrohet of the Android Studio team, there might be a bug in the Maven plugin for Gradle.

The ADT-DEV thread is here:

https://groups.google.com/d/msg/adt-dev/PYNygZyMfOI/jYyi_UMT6h8J

I found the problem. In my build.gradle file, I was inadvertently passing “null” as the pom.version, since on this line:

https://github.com/couchbase/couchbase-lite-java-javascript/blob/7be88dadf91b60f3b39f2264d700e4e393d65635/build.gradle#L54

System.getenv(“MAVEN_UPLOAD_VERSION”) was returning null.

The workaround is to pass an empty string if System.getenv(“MAVEN_UPLOAD_VERSION”) is null, ie:

https://github.com/couchbase/couchbase-lite-java-javascript/blob/4df487df3e2589b38b8f2ad7ea45a31fc84b6955/build.gradle#L54

Gradle should be enhanced to do some validation and throw a more meaningful error like “pom.version cannot be null”, which would make this kind of error a lot easier to fix.