Fork me on GitHub
#boot
<
2017-04-18
>
wottis00:04:53

how to make use of java imports within a task definition?

richiardiandrea01:04:20

@wottis you can just import as in Clojure, do you have any specific error?

wottis01:04:17

@richiardiandrea yes it says that no such namespace DriverManager

richiardiandrea01:04:44

@wottis looks good, so maybe the problem is in the dependency vector

wottis01:04:10

i don't know how i'm supposed to add java.sql to that because it's part of the core library of java

richiardiandrea01:04:45

uhm works here

boot.user=> (import 'java.sql.DriverManager)
java.sql.DriverManager
boot.user=> (DriverManager/getConnection nil nil)

boot.user=> java.sql.SQLException: The url cannot be null

richiardiandrea01:04:21

unless it is a java8 only API

wottis01:04:31

yeah that certainly works in the repl

richiardiandrea01:04:52

not familiar at all with java.sql

wottis01:04:54

but if i want to run the task via the commandline things start to fail

richiardiandrea01:04:20

try to wrap the calls with with-pre-wrap

wottis01:04:05

ok so when run via command-line it throws the exception that there's no such namespace. when running the task via the repl it can't resolve the long-name of the task options.

wottis01:04:32

still the same

richiardiandrea01:04:32

so it does not work with (boot (task :your-option your-value)) ?

wottis01:04:08

ah that's how it need to be run

wottis01:04:11

@richiardiandrea thank you very much!

wottis01:04:34

but how can i run it via the cmd-line

wottis01:04:44

boot initialize-oacc

richiardiandrea01:04:52

it should be boot task --options asras

richiardiandrea01:04:01

yeah like the above

richiardiandrea01:04:32

not sure why it is failing, i would maybe try to pin the boot version

wottis01:04:10

not with the options, but because it still fails to import the deps. this means i have to create a pod? because it seems the task doesn't know about the deps specified by set-env!

richiardiandrea01:04:28

well no the pod should not be necessary

richiardiandrea01:04:50

set-env! sets the deps for the main pod

richiardiandrea01:04:22

maybe there is something else going on I cannot see at the moment

wottis03:04:27

@richiardiandrea when the import expression is outside of the task definition it works