I wanted to know whether this compiled the java-sources in sub-folders as well, and could handle packages-notation, a good functionality when already having a code base in java . Leiningen did not put me down, it did take good care of all this.
I added a
:java-source-path "java"
to Leiningen's project.clj. And then
mkdir java/se/linusericsson/www
where I created a small TestPackage.java:
package www.linusericsson.se;
public class TestPackage {
int i = 100;
public int geti() {return i}
public void seti(int j) {i = j;}}
I ran lein javac (says something like one file compiled)
in lein repl
(import 'www.linusericsson.se.TestPackage)
(def tp (TestPackage.))
(.geti tp)
=> 100
(.seti 145 tp)
(.geti tp)
=>145 ;;OK!
note:
(Xxx.) means new Xxx in java.
(.geti
Inga kommentarer:
Skicka en kommentar