luchiniatwork / cambada

Packager for Clojure based on deps.edn (AKA tools.deps). Supporting jar, uberjar and GraalVM's native-image.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems with finding main entry class for uberjar and native-image

jumski opened this issue · comments

Got a simple cljfx project that i want to get built with cambada (ideally with native-image, but i'm kind of stuck on uberjar now).

Project repo: https://github.com/jumski/tone-collector/tree/add-cambada

My deps.edn file:

{:deps
 {org.clojure/clojure {:mvn/version "1.10.0"}
  cljfx {:mvn/version "1.6.7"}
  overtone/midi-clj {:mvn/version "0.5.0"}}
 :aliases
 {:uberjar {:extra-deps {luchiniatwork/cambada {:mvn/version "1.0.2"}}
            :main-opts ["-m" "cambada.uberjar"
                        "-m" "jumski.tone-collector.core"]}}}

Building uberjar

It mainly works with small warnings (that i assume are insignificant because they are about some logger)

warnings

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

But when i try to run the uberjar with

java -jar target/tone-collector-1.0.0-SNAPSHOT-standalone.jar

I got this error:

Error: Could not find or load main class jumski.tone-collector.core
Caused by: java.lang.ClassNotFoundException: jumski.tone-collector.core

By trial and error i figured out that when i provide the -m as a slash/underscore path like this, it will work:

-                        "-m" "jumski.tone-collector.core"]}}}
+                        "-m" "jumski/tone_collector/core"]}}}

I do not really understand what is the problem here.

Building native-image

When i try to use native-image support it fails with ERROR! Error: Main entry point class 'jumski.tone-collector.core not found for both jumski.tone-collector.core and jumski/tone_collector/core variants of main entry point spec.

Error for `jumski.tone-collector.core`

ERROR! Error: Main entry point class 'jumski.tone-collector.core' not found.
com.oracle.svm.core.util.UserError$UserException: Main entry point class 'jumski.tone-collector.core' not found.
        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:300)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:501)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:115)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:528)
Error: Image build request failed with exit status 1

Error for `jumski/tone_collector/core`

ERROR! Error: Main entry point class 'jumski/tone_collector/core' not found.
com.oracle.svm.core.util.UserError$UserException: Main entry point class 'jumski/tone_collector/core' not found.
        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:300)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:501)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:115)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:528)
Error: Image build request failed with exit status 1

Am i missing something or there is some kind or problem in cambada?

Versions

› clj --help
Version: 1.10.1.536

› gu --help
GraalVM Component Updater v2.0.0

› native-image --version
GraalVM Version 20.0.0 CE

› java --version
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)