elki-project / elki

ELKI Data Mining Toolkit
https://elki-project.github.io/
GNU Affero General Public License v3.0
781 stars 321 forks source link

Build Issue: :elki-logging:compileJava - NullPointerException #91

Closed lapplislazuli closed 3 years ago

lapplislazuli commented 3 years ago

Hi,

I'm trying to build as per README within a Docker, and my Gradle Build is failing.

I use the following short Dockerfile:

FROM gradle:7.1-jre11
#FROM gradle:7.1-jre8

WORKDIR /build

COPY . .

RUN ["./gradlew","build","--stacktrace"]

which gives the following

[...]
#8 33.82 > Task :elki-core-util:generateCodeArrays
#8 34.62 > Task :elki-core-util:generateCodeHeaps
#8 34.82 > Task :elki-logging:compileJava FAILED
#8 34.82 
#8 34.82 FAILURE: Build failed with an exception.
#8 34.82 
#8 34.82 * What went wrong:
#8 34.82 Execution failed for task ':elki-logging:compileJava'.
#8 34.82 > java.lang.NullPointerException (no error message)
#8 34.82 
#8 34.82 * Try:
#8 34.82 Run with --info or --debug option to get more log output. Run with --scan to get full insights.
#8 34.82 
#8 34.82 * Exception is:
#8 34.82 org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':elki-logging:compileJava'.
[...]

(Full file output.log)

I have this also outside of the Docker. I get the same errors for gradle jar and gradle shadowjar, also on JDK8.

kno10 commented 3 years ago

Clearly this is an error in Gradle, not in ELKI.

My guess is that you did not install a Java JDK, and hence your docker container cannot compile Java.

Try using a JDK container, not a JRE container. i.e., try

FROM gradle:7.1-jdk11

not jre.

If that resolves the issue, please file a bug with gradle to provide a more helpful error message (e.g., "no JDK installed") instead of a NPE.

lapplislazuli commented 3 years ago

@kno10 Thanks, that ... I feel ashamed now :S

kno10 commented 3 years ago

It's not your fault. Gradle should provide a better error message instead of

java.lang.NullPointerException (no error message)

kno10 commented 3 years ago

FYI: the next version of Gradle should report "Java compiler is not available." via gradle/gradle/pull/17617