Fork me on GitHub
#tools-deps
<
2023-02-27
>
pmooser12:02:37

I'm having a bit of trouble using a library with a java compilation step with :deps/prep-lib. I have a project A with a :local/root dependency on a project B that has a :deps/prep-lib entry that compiles java. I can do a clj -X:deps prep from the project directory of A, and that works - I get a message about prepping B, and the compilation results are in B/target/classes. The problem is that the generated classpath of A doesn't seem to include anything like the target/classes directory of B, so when A launches, we get an error that the java class wasn't found (because it's not on the classpath). When we prep a lib, I assume it's correct for the lib's prep results to be in its own directory?

borkdude12:02:19

Does dependency B have the target directory in its :paths in its deps.edn?

borkdude12:02:38

prep/libs doesn't magically add directories to the classpath, they should be declared in deps.edn

pmooser12:02:49

Ok, that explains it then.

pmooser12:02:55

By the way, you are everywhere.

pmooser12:02:09

I really appreciate your help but I begin to feel a bit guilty that you're the one who answers all of my questions. ๐Ÿ™‚

pmooser12:02:01

I feel like this sort of means that I need to have target/classes in the classpath just for this case, even if it isn't required (I don't think) for the normal case where I've deployed a jar.

borkdude12:02:21

No problem at all, happy to help. If you want to do anything in return, feel free to sponsor. I'd rather have people do this out of gratitude rather than guilt though :)

borkdude12:02:17

it doesn't hurt to add target to the classpath if it doesn't exist btw

pmooser12:02:06

Ok yes, adding "target/classes" as a resource path in the library (`B`) resolves the problem, as you suggested it would.

๐Ÿ‘ 2
vxe14:02:14

hello, has pulling from http maven repos been intentionally dropped in some clojure 1.11 verision? I am getting

clojure -Spom -Srepro 
...
Error building classpath. Invalid repo url (http not supported): 
on clj version 1.11.1.1224 , the command succeeds on 1.11.1.1200 . if intentional are there are any workounds on the maven side to get around the http check, thanks in advance
% java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

Alex Miller (Clojure team)15:02:16

Yes, this is no longer allowed in the Maven ecosystem to protect against man-in-the-middle attacks so we've followed their lead, see https://maven.apache.org/docs/3.8.1/release-notes.html#cve-2021-26291

Alex Miller (Clojure team)15:02:56

If there is a need here (seems like there might be), please file a question on http://ask.clojure.org and I will consider a way to allow it with some config

Alex Miller (Clojure team)15:02:42

in the meantime, you'll want to fall back to the older release - you can find instructions on how to do that with brew at https://github.com/clojure/homebrew-tools#version-archive-tool-releases (with Linux you just install the older version)

Alex Miller (Clojure team)15:02:20

it would be helpful to know if you are using Maven mirroring in your settings.xml

practicalli-johnny17:02:16

Upgrading Nexus server to use HTTPS is the recommended approach I assume Maven gives (or use a mirror service that supports HTTPS) I vaguely remember we updated Nexus back in 2018 when Maven introduce this change. Or maybe we migrated to artefactory Leiningen dropped support for http repos around the same time, with release 2.9.x

Alex Miller (Clojure team)17:02:20

yes, that is the recommendation from Nexus

Alex Miller (Clojure team)17:02:57

but I also don't want to make this unusable in the meantime so I gate the check with a flag or something

Alex Miller (Clojure team)01:02:29

I don't know if you saw in other threads, but I released a new version of the Clojure CLI today that allows you to reenable it by setting the environment variable CLOJURE_CLI_ALLOW_HTTP_REPO

vxe23:02:15

awesome thank you ๐Ÿ™

seancorfield23:02:40

When will -A stop running :main-opts? ๐Ÿ™‚