Clojure introduction of another Java class implemented by Clojure

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.