Reputation: 4513
Let's say I have the following file:
hello/core.clj:
(ns hello.core)
(println "Hello")
Is it possible to AOT compile this file to classfiles using a clj
tool without using any "project"-like setup? I've tried something like this:
$ clj -e '(compile "hello/core")'
but am getting an error about unability to locate hello/core.clj
file.
Upvotes: 2
Views: 402
Reputation: 16194
Looks like clj
's default expectation is for source files to be under src
directory (from the guide):
By default, the
clj
tool will look for source files in thesrc
directory, so create thesrc
directory and declare your program atsrc/hello.clj
And for compile
to work, *compile-path*
(defaults to "classes"
) must also exist:
$ mkdir classes
$ tree
.
├── classes
└── src
└── hello
└── core.clj
$ test clj -e "(compile 'hello.core)"
Hello
hello.core
Then your class files should be in classes
directory.
Upvotes: 3