That's a bit of a detour, that's what happened.
CORE.CLJ file to use a Java class, this Java Class (Movedailyaction) is generated by the Clojure code of the same project, Clojure Java class Please refer to the previous blog
Clojure Implementing Java Classes
Now it is necessary to place the class file of the Java class generated by Clojure in the specified directory, and then let Core.clj be able to refer to the class file. This is mainly by Leiningen engineering configuration
The first one needs to be set with Compile-path
: Compile-path "%s/classy-files"
The compilation results will appear in the following directory
LS target/uberjar+uberjar/classy-files/kafka2hdfs/core.class core$_main.class movedailyaction$_ Execute.class movedailyaction$loading__4910__auto__.classcore$fn__48.class core$mk_topology.class Movedailyaction$fn__26.classcore__init.class core$submit_topology_bang_.class MoveDailyAction__ Init.classcore$loading__4910__auto__.class movedailyaction.class movedailyaction$_init.class
The second one needs to be set with Java-source-paths
: java-source-paths ["%s/classy-files"]
This allows you to use the first-step compiled class file.
Note: The Clojure class that is dependent on the AOT setting needs to be compiled first, so put it in front
: AOT [Kafka2hdfs. Movedailyaction Kafka2hdfs.core]
Now run the command to compile it:
Lein do clean, Uberjar
Complete.
Leiningen official documentation is not documented Compile-path, you can refer to GitHub's example
Https://github.com/technomancy/leiningen/blob/master/sample.project.clj
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Clojure introduction of another Java class implemented by Clojure