Skip to content

Instantly share code, notes, and snippets.

@mishok13
Created October 24, 2012 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mishok13/3945518 to your computer and use it in GitHub Desktop.
Save mishok13/3945518 to your computer and use it in GitHub Desktop.
Failing to make UserAgentUtils work with Clojure
# Project created by running the following command
$ lein new helloworld
# src/helloworld/core.clj
(ns helloworld.core
(:import [nl.bitwalker.useragentutils.UserAgent])
(:gen-class :main true))
(defn -main
[& args]
(println UserAgent))
# project.clj
(defproject helloworld "0.1.0-SNAPSHOT"
:main helloworld.core
:dependencies [[org.clojure/clojure "1.4.0"]
[nl.bitwalker/useragentutils "1.6"]])
# nl.bitwalker.useragentutils installed using following command:
$ wget http://java.net/projects/user-agent-utils/downloads/download/UserAgentUtils-1.6.jar
$ mvn install:install-file -Dfile=UserAgentUtils-1.6.jar -DgroupId=nl.bitwalker.useragentutils -DartifactId=UserAgentUtils -Dpackaging=jar -Dversion=1.6 -DgeneratePom=true -DcreateChecksum=true
# Exception stacktrace when trying to compile
lein2 compile
Compiling helloworld.core
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: UserAgent in this context, compiling:(helloworld/core.clj:7)
at clojure.lang.Compiler.analyze(Compiler.java:6281)
at clojure.lang.Compiler.analyze(Compiler.java:6223)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3548)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6457)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyze(Compiler.java:6223)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5054)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3674)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyze(Compiler.java:6223)
at clojure.lang.Compiler.compile1(Compiler.java:7030)
at clojure.lang.Compiler.compile(Compiler.java:7097)
at clojure.lang.RT.compile(RT.java:387)
at clojure.lang.RT.load(RT.java:427)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$compile$fn__4895.invoke(core.clj:5426)
at clojure.core$compile.invoke(core.clj:5425)
at user$eval103.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve symbol: UserAgent in this context
at clojure.lang.Util.runtimeException(Util.java:170)
at clojure.lang.Compiler.resolveIn(Compiler.java:6766)
at clojure.lang.Compiler.resolve(Compiler.java:6710)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6671)
at clojure.lang.Compiler.analyze(Compiler.java:6244)
... 42 more
Compilation failed: Subprocess failed
Copy link

ghost commented Oct 24, 2012

I had to use this instead, to get to the same error:

c:\1> s:\down\apache-maven-3.0.4-bin\apache-maven-3.0.4\bin\mvn install:install-file -Dfile=UserAgentUtils-1.6.jar -DgroupId=nl.bitwalker -DartifactId=useragentutils -Dpackaging=jar -Dversion=1.6 -DgeneratePom=true -DcreateChecksum=true

@mishok13
Copy link
Author

@AtKaaz Thanks, I was thinking I'm going completely nuts.

Copy link

ghost commented Oct 27, 2012

Just for consistency's sake (whoever stumbles upon this gist), imma mention that you fixed it in this ML:
https://groups.google.com/d/msg/clojure/JCwpbqbrHUE/EB_PoTuQ0NEJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment