Open charleslparker opened 12 years ago
Yeah, in this case the problem is that you can't change :source-paths
while using :eval-in-leiningen
. The message should be clearer though.
But using trampoline
to "bounce around" that restriction is a legal move, or is it some sort of hole that's going to be closed?
I'd say it's a loophole. The point of trampoline is to avoid the creation of a subprocess, which is something you already get by definition with :eval-in-leiningen
. There are certain restrictions with :eval-in-leiningen
that we can't work around due to bootstrapping difficulties; having things behave differently in trampoline on purpose is not something I want to support; it's undefined behaviour. Why are you setting :eval-in-leiningen
to begin with?
I'd say it's a loophole.
I figured it was.
Why are you setting :eval-in-leiningen to begin with?
I've got project-specific tasks defined in src/leiningen
.
On a related note, I've got a more minimal example of the problem:
1.) Start a new project with lein new tproj
.
2.) Modify project.clj
so it looks like this:
(defproject tproj "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]]
:eval-in-leiningen true
:aot [tproj.core]
:main tproj.core)
3.) and src/tproj/core.clj
:
(ns tproj.core
(:gen-class :main true))
(defn -main [& args]
(println "Hello, Main!"))
And you get the following behavior:
Charless-MacBook-Air:tproj charleslparker$ lein2 clean
Charless-MacBook-Air:tproj charleslparker$ lein2 run
Compiling tproj.core
Compilation failed: java.io.IOException: No such file or directory, compiling:(tproj/core.clj:1)
Charless-MacBook-Air:tproj charleslparker$ lein2 clean
Charless-MacBook-Air:tproj charleslparker$ lein2 trampoline run
Warning: trampoline has no effect with :eval-in-leiningen.
Compiling tproj.core
Compiling tproj.core
Hello, Main!
Charless-MacBook-Air:tproj charleslparker$
Taking out :eval-in-leiningen
makes things behave again. Also, taking out :aot
and :main
allows compilation and testing. If one isn't supposed to use eval-in-leiningen
to create project-specific tasks, I'll volunteer to add a comment on some Stack Overflow responses :)
Thanks for all your hard work on this, by the way. It's a really nice thing.
Charles Parker notifications@github.com writes:
Why are you setting :eval-in-leiningen to begin with?
I've got project-specific tasks defined in src/leiningen.
OK, that's handled much better by this:
$ mkdir tasks
$ mv src/leiningen tasks/
$ echo tasks > .lein-classpath
On a related note, I've got a more minimal example of the problem:
[...]
Charless-MacBook-Air:tproj charleslparker$ lein2 clean Charless-MacBook-Air:tproj charleslparker$ lein2 run Compiling tproj.core Compilation failed: java.io.IOException: No such file or directory, compiling:(tproj/core.clj:1)
This might be pointing to a different problem where the project's default
:compile-path
needs to be changed if it's using :eval-in-leiningen
.
OK, that's handled much better by this:
Indeed it is - I've made a few posts so it doesn't get forgotten. I'd also be happy to do a little PR to update PLUGINS.md with this information if you think it would be useful. I think it's a pretty common case and there's not much on the innertubes about it (as it is in 2.x).
@charleslparker +1 on a PR or wiki edit to update lein project documentation to point this out. This is great stuff - somehow I didn't know about it either.
Yeah, there's a brief mention in PLUGINS.md, but I agree it's not easy to find. Happy to have that improved.
Leaving this open with a different name so we could get warnings about what can't be changed with :eval-in-project
.
I don't have much experience with Leiningen, but this looks awfully strange (note that I have
lein2
as both 2.x and 1.7.x are running on my system).Clearly
trampoline
does have some effect. The same thing happens withlein2 test
; I can run tests when using trampoline, but the build fails when I don't.My
project.clj
: