IllegalStateException Compiling Clojure-Contrib - clojure

I am trying to compile my own version of clojure-contrib with Maven I get the following exception:
Exception in thread "main" java.lang.IllegalStateException: Can't dynamically bind non-dynamic var: clojure.contrib.pprint/*format-str*, compiling:(dispatch.clj:90)
I am also using the following command to compile it:
mvn package -Dclojure.jar=/usr/local/share/jars/clojure.jar
clojure.jar is link to the actual jar (that is on the same directory) because I am using a version that I compiled from the Git repository.
Any Ideas?
Thanks in advance for your comments! =)

clojure-contrib, the single monolithic build, is deprecated after Clojure 1.2.0 and is not actively maintained. It doesn't build on the latest Clojure 1.3.0-alpha* releases.
New contrib libraries, one per Github repository, are being created under http://github.com/clojure
See http://dev.clojure.org/display/design/Clojure+Contrib and its sub-pages for more information.

Related

I have an error in Clojure and leiningen command

I am working on a project in Clojure. I tried to migrate my latest DB commit to my local using the command
PROFILE=dev lein ragtime migrate
Getting this error:
clojure.lang.Compiler$CompilerException: Syntax error macroexpanding
clojure.core/fn at (clojure/core/unify.clj:83:18).
:clojure.error{:phase :macro-syntax-check, :line 83, :column 18,
:source "clojure/core/unify.clj", :symbol clojure.core/fn}
I also encountered this issue with Leiningen 2.9.1. In my case it turned out to occur due to the lein-ring plugin which depends on an outdated unify version. The issue is already fixed in the newest lein-ring version though: https://github.com/weavejester/lein-ring/issues/203. So upgrading lein-ring to 0.12.5 fixed it for me.
I'm not 100% sure what this issue is, but it seems to be related to leiningen 2.9.x.
At first, I ran leiningen v 2.8.x (don't remember which version exactly). Then everything worked fine.
Then I updated leiningen to 2.9.1, and I got this error the next time I tried to build with leiningen.
We then updated ring from version 1.4.0 to 1.7.1, and the error disappeared.
Alternatively, if you have to use an old version of a library, the only fix seems to be to downgrade to leiningen 2.8:
lein upgrade 2.8.3
Downgraded to 2.7.1 and it worked for me
Maybe your project.clj is malformed. I wonder where the ragtime command comes from? It seems that the previous developer implemented their own plugin for ragtime integration because it differs from the way suggested in the official wiki. It would be nice if you share some bits of your project.clj as well as the code that provides the connection b/w ragtime and lein.

Cannot use Clojure 1.7 with Leiningen

Using Leiningen, I'm unable to use Clojure 1.7 in project, but I am able to use later versions.
For instance, if I clone down the Om Next Tutorial and try to run it, I get a java.lang.NoClassDefFoundError: clojure/lang/Tuple. Full stack trace here. A similar error occurs any time I try to use Clojure 1.7 in a project with Leiningen.
However, the error goes away if I upgrade to Clojure 1.8 or 1.9 in project.clj. The trouble is that I'm not always in a position to upgrade the version on a project.
Versions installed:
Clojure: 1.8.0
Java: OpenJDK 1.8.0_171
Leiningen: 2.8.1
Ubuntu: 16.04 LTS
The problem happens with or without my lien profiles.clj.
I'm not a Java expert, but this looks like a classpath issue to me. I am using update-java-alternatives to set the path to Java 1.8.
Edit: I created a minimal repo that reproduced the problem, using the very first part of the Om Next tutorial, here.

How to obtain an MRUnit 1.0.0-SNAPSHOT jar built using the hadoop1 classifier?

The latest release of MRUnit is 0.9. This release does not support DistributedCache.
This https://issues.apache.org/jira/browse/MRUNIT-98 shows that 1.0.0 supports DistributedCache. I want to get ahold of an MRUnit 1.0.0 jar that is built for hadoop1, but I cannot find one. So I tried to build it myself, but the required jars are missing from the maven repo.
Here is the command I'm using:
mvn package -DenvClassifier=hadoop1 -DspecificHadoopVersion=1.0.3
It fails with dependency errors. I can get ahold of the required jars manually, but I don't know how to get the build to use them.
How can I get ahold of the jar I want (either build it myself, or download it)?
I figured this out after I posted the question.
The answer is simple. Checkout the hadoop1 branch, and build that:
$ git checkout -b local/trunk-hadoop1 remotes/origin/trunk-hadoop1
$ mvn package

How do I use a newer version of r.js with Yeoman build?

I'm trying to run yeoman build on a project that uses requireJS and the require-handlebars-plugin. I'm am getting this error when running the rjs task:
<WARN> Error: ENOENT, no such file or directory '/Users/tkrell/Sites/pathrabbit-marionette-require/temp/scripts/template/schedules/day-jobs -past.js'
In module tree:
main
schedules/schedule-layouts
schedules/schedule-jobs-view
hbs
at Object.fs.openSync (fs.js:338:18)
Use --force to continue. </WARN>
I believe this is the same as this issue which appears to simply need the latest version of r.js to be resolved. When I use a newer version of r.js manually, I don't get the error and everything works fine. How can I force the yeoman build task to use the latest version r.js?
The advice given on the issue I created on Yeoman's github page worked for me:
Yeoman uses 2.0.2 (see it's package.json).
You could go into the directory yeoman is installed and run npm install -f requirejs to force install a newer version. No promises it won't break though.
However, in yeoman 1.0 (which is imminent), we'll be using grunt-requirejs instead.

Leiningen's eclipse plugin is asking for duck streams?

I'm trying to follow this tutorial on Seesaw Window Building.
During the step of automatically creating eclipse project file I get errors asking for duck_streams.
lein-eclipse doesn't look like it's been updated in 2 years which means it's using the old contrib library. However in the tutorial clojure 1.3.0 is being used.
This leaves me confused as to why the tutorial example works and what I should do to run the lein-eclipse plugin?
$ lein plugin install lein-eclipse 1.0.0
[INFO] Unable to find resource 'lein-eclipse:lein-eclipse:jar:1.0.0' in repository central (http://repo1.maven.org/maven2)
Including lein-eclipse-1.0.0.jar
Created lein-eclipse-1.0.0.jar
$ lein eclipse
Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath: (eclipse.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5441)
[snip]
Caused by: java.io.FileNotFoundException: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath:
at clojure.lang.RT.load(RT.java:412)
[snip]
I don't know if you found this out, but lein-eclipse is a bit out of date, yet I think you'd be better served by installing the Counterclockwise plugin, which as of version 0.9.0, supports Leiningen projects natively in Eclipse. I use this plugin and Eclipse as my primary development environment, and I like this setup quite a bit.
Counterclockwise
Counterclockwise Update Site