Fork me on GitHub
#tools-deps
<
2019-04-11
>
borkdude06:04:00

if I check some files into a resources folder in my git repo, will someone who uses my repo as a git dep be able to see these resources? I remember there was an issue with this in tools.deps?

borkdude06:04:07

or was this only when you’re using it as a local/root?

borkdude06:04:11

after some testing, both seem to work

borkdude06:04:25

I remember what the issue was with this. maybe a caching issue

borkdude15:04:28

with leiningen it seems that lib/tools.jar is automatically on the classpath. with tools.deps it doesn’t seem so. what’s the best way to do it without using a cmd line like:

clj -Sdeps "{:deps {tools.jar {:local/root \"$JAVA_HOME/lib/tools.jar\"}}}"

Alex Miller (Clojure team)15:04:56

you should not have to do this

Alex Miller (Clojure team)15:04:24

it should automatically be included if you are using the JDK (not the JRE) afaik

Alex Miller (Clojure team)15:04:32

are you accidentally using the JRE?

Alex Miller (Clojure team)15:04:33

might also be some differences from Java 8 vs Java 9+ (post-module system) in the jdk file structure. I'm not sure there even is a tools.jar anymore?

Alex Miller (Clojure team)15:04:54

oh yeah, as of java 9, tools.jar does not exist anymore

Alex Miller (Clojure team)15:04:14

needing to include it directly is weird, and probably wrong

ghadi15:04:09

if the original question was about resources, as long as that directory is listed in the :paths on the dependent repo, then the depending repo will be able to see it

borkdude15:04:18

I’m using java 8

borkdude15:04:49

a quick test if it works in any of your REPLs:

(import 'com.sun.tools.javadoc.Main)

borkdude15:04:26

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home

borkdude15:04:58

is there something newer I should use?

Alex Miller (Clojure team)15:04:15

yes - javax.tools.DocumentationTool

Alex Miller (Clojure team)15:04:03

I don't know the coords for it, but you should just be using it as normal Maven artifact

borkdude15:04:46

that seems to work out of the box:

$ clj
Clojure 1.10.0
user=> (import 'javax.tools.DocumentationTool)
javax.tools.DocumentationTool

Alex Miller (Clojure team)15:04:56

prob doesn't in newer jdks

Alex Miller (Clojure team)15:04:13

actually, it does on Java 11

borkdude15:04:49

so I can do something like this as with the older Doclet API? I want to generate EDN

Alex Miller (Clojure team)15:04:03

I believe it is the replacement for all that old sun stuff, yes

Alex Miller (Clojure team)15:04:23

I'm sure there are buckets of docs to read about it, I've never used it

borkdude16:04:59

It seems I do need the “dead” Doclet class if I’m using Java 8, since the jdk.javadoc stuff is only on Java 9

borkdude16:04:24

so I’m seeing this in the REPL:

(System/getProperty "java.home")
"/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre"
and the same with leiningen. But tools.jar is in ../jdk/lib/tools.jar.

borkdude16:04:40

I wonder that if I’m going to migrate to JDK 11 if my code will still be able to run for Java 8 users if I’m going to use those new classes, so I’m hesitant about it

Alex Miller (Clojure team)16:04:44

it should be fine. that "new" doclet stuff has been around since at least java 7

Alex Miller (Clojure team)16:04:26

seems better than building on something that has been pronounced dead and unsupported

borkdude16:04:21

but the new doclet stuff is only there since Java 9, or maybe I’m not finding the right stuff on google…

borkdude16:04:01

OK yeah, I’m going to use that.

dominicm17:04:11

What are you using doclet for?

dominicm17:04:30

Oh, it's for reading docs in java. I see.

dominicm17:04:41

I thought it was for generating them.

Alex Miller (Clojure team)17:04:39

everything com.sun is on the removal path

ghadi17:04:56

make sure you read the migration parts of ^

borkdude17:04:26

Old type: SeeTag New type: com.sun.source.doctree.LinkTree com.sun.source.doctree.SeeTree Hmm..

borkdude17:04:48

Crap, it does seem that this new stuff is only available since 9

borkdude17:04:33

Anyway, thanks for the help.

noprompt17:04:55

Do we have tool for releasing to Clojars in deps land?

borkdude17:04:10

There are a bunch of these tools on the wiki

noprompt17:04:11

I’m still lein deploy clojars. 😐

noprompt17:04:46

I reckon if any of those were as convenient as that you’d have mentioned it. 🙂

borkdude17:04:50

Haven’t tried them yet

noprompt17:04:42

I just want a microwave.

noprompt17:04:59

A jar cooking microwave.

borkdude17:04:10

depstar is one that I’ve heard of

Alex Miller (Clojure team)17:04:24

you can call lein fns from clj

borkdude17:04:35

@noprompt this is an example of calling lein using tools.deps: https://github.com/oakes/full-stack-clj-example nice hack

Alex Miller (Clojure team)17:04:00

I added that to the wiki page :)

mpenet19:04:03

it doesnt work with git deps, it uses lein for dependency resolution when building the uberjar https://github.com/oakes/full-stack-clj-example/blob/master/prod.clj

mpenet19:04:28

I'd still favor pack/depstar

mpenet19:04:36

I guess it could be improved, the concept is quite interesting

noprompt17:04:48

Cool. I’ll check that out. pack looks pretty nice. The Juxt folks tend to make decent things.

❤️ 4
dominicm20:04:41

I appreciate the complement. Let me know if you have any issues.

sooheon09:04:07

Does the capsule method of uberjaring not support AOT compilation?

dominicm10:04:50

It works with AOT'd assets

dominicm10:04:57

Why do you think it doesn't?

sooheon10:04:38

I’m coming from lein uberjar where you explicitly give it a ns to AOT compile. Also saw that Capsule main didn’t care about :gen-class. Do you mean I should AOT compile with something else, and provide the output of that as extra-paths?

dominicm10:04:45

If you really want to AOT, yeah, I just use clojure -e

borkdude17:04:51

(it’s not an off the shelve solution)

martinklepsch18:04:16

I found that there's a thing for every step of the process but none that puts all those bits together sadly

seancorfield18:04:09

We're using (my fork of) depstar at work for building uberjars. I'm also using it to build "thin" jars for deploying to Clojars (and I use mvn deploy for that, so I run clj -Spom, clj -A:uberjar (alias for depstar's uberjar entry point), and then mvn deploy:deploy-file ...)

ghadi18:04:34

that will get you going

seancorfield18:04:10

(well, I have a little shell script that combines that -- and also updated the pom.xml with the current SHA of the project so http://clojars.org can point to the commit on GitHub)

noprompt18:04:02

Nice. I’ll give this a try.

borkdude19:04:21

Darn. > This class must contain the start(Root) method. This is in Java 11 documentation for javadoc which is also used by those new ToolProvider thingies. But the start(Root) method is from the ancient com.sun code. So this buys me nothing… The documentation for the new Doclet interface doesn’t even mention this though. https://docs.oracle.com/en/java/javase/11/tools/javadoc.html