tools-build

2021-09-23T10:20:29.308400Z

In the tools.build example here: https://clojure.org/guides/tools_build#_compiled_uberjar_application_build Why write a pom to an uberjar??

2021-09-23T10:22:34.309700Z

Infact I really don’t understand that example… Is that building a library or application?! In my experience they’re typically very different types of build.

pavlosmelissinos 2021-09-23T10:32:47.311Z

> Compiled uberjar application build > > When preparing an application, [...] There's another section right above the one you linked to that describes how to create a jar for a library. Seems pretty clear to me, unless you're referring to something else?

2021-09-23T10:33:57.311200Z

Yes I see the two titles… What I’m asking is why an application / uberjar would typically require a pom.xml to be put inside it.

2021-09-23T10:35:15.311500Z

given that you never put applications in clojars or maven central — or depend on them like libraries.

Alex Miller (Clojure team) 2021-09-23T12:33:57.333400Z

You don't have to

Alex Miller (Clojure team) 2021-09-23T12:34:41.334700Z

You still might put it in a local or company repo where metadata is useful

2021-09-23T12:36:54.335300Z

maybe — I’m not saying you’d never want to do this; just that it seems like an odd example for building an application.

Alex Miller (Clojure team) 2021-09-23T12:38:21.336600Z

Well, I could remove that part if it's confusing

2021-09-23T12:39:59.336800Z

I think it might help… It’ll make it clearer that the pom isn’t actually necessary for an uberjar.

Alex Miller (Clojure team) 2021-09-23T12:41:15.337900Z

It's not necessary for any classpath - we should maybe be filtering this in tools.deps

2021-09-23T12:43:01.338100Z

is that comment meant for this thread or the main thread?

Alex Miller (Clojure team) 2021-09-23T12:47:32.338300Z

here - .pom files have no meaning in a classpath

Alex Miller (Clojure team) 2021-09-23T12:48:04.338500Z

oh sorry, maybe not here

2021-09-23T12:48:10.338700Z

😁

Alex Miller (Clojure team) 2021-09-23T12:48:11.338900Z

too many threads!

2021-09-23T12:48:18.339100Z

yeah sorry

2021-09-23T12:49:03.339300Z

Also thanks again for everything 🙇 I’ve been enjoying trying to port some things over to tools.build

seancorfield 2021-09-23T15:41:46.339600Z

In my build-clj wrapper, you can omit :version and then uber skips the pom-writing.

2021-09-23T10:24:56.310900Z

Yes, you sometimes see libraries that are also wrapped into a CLI app or something — but it seems to me in those projects you’re still doing two very different two things; deploying a library for API consumers and building an application.

mike_ananev 2021-09-23T10:47:14.316700Z

@rickmoynihan For me, pom.xml is useful in two scenarios: 1. Inspect artifact on CI to control deps licenses. We want to avoid use of incompatible licenses. 2. In closed environment (without Internet) we have to use maven + pom.xml to download dependencies from corporate Nexus before build. This is because in tools deps we cannot use custom settings.xml. On our CI servers ~/.m2/settings.xml is always empty and we should use custom settings.xml for every project to set corporate Nexus. Depstar (now archived) help us to solve this issue.

2021-09-23T11:02:44.325700Z

I can see the first might be useful for audit in some very specific scenarios — but you could just as easily do it before you generated the build. The second point isn’t really relevant to what I’m asking. i.e. I understand the role of maven in acquiring dependencies so you can make your build. What I don’t understand is why the guide is suggesting you put the pom.xml into the application. It seems to me that the example is bluring the distinction between building and deploying a library; and building an application/uberjar. It’s not uncommon to see this distinction blurred. For example depstar which you referenced complected both concerns together trying to be a tool for both uberjarring applications and jarring libraries. Yes there are some commonalities; but IMHO most of the complexity in depstar was due to needing to isolate classpaths for the uberjar application case; which meant it couldn’t acquire new features and in particular 3rd party deps — which would have helped improve the situation for creating libraries e.g. updating versions in poms etc…

seancorfield 2021-09-23T15:44:57.339800Z

That was only true in 1.0. In 2.0 the classpath was built separately and depstar had whatever deps it needed.

👍 1
2021-09-23T11:38:19.326900Z

Another tools.build question… When would you want to b/compile-clj with :sort :bfs instead of :sort :topo?

Alex Miller (Clojure team) 2021-09-23T12:32:55.333Z

I don't know if you'd ever want it but I left it as an option

2021-09-23T12:34:02.333600Z

I guess it might be quicker if it’s already built stuff, as it’s checking from the top down?!

Alex Miller (Clojure team) 2021-09-23T12:37:36.336Z

That's topo - bfs is basically doing the compilation in lexica sort order

👍 1
2021-09-23T12:22:00.329400Z

Ok another question/issue… I’m now getting the following exception when running b/uber

2021-09-23T12:23:05.329700Z

1. Unhandled clojure.lang.ExceptionInfo
   Unexpected lib file:
   /Users/rick/.m2/repository/org/apache/jena/apache-jena-libs/3.10.0/apache-jena-libs-3.10.0.pom
   {}
                  uber.clj:  182  clojure.tools.build.tasks.uber/explode
                  uber.clj:  141  clojure.tools.build.tasks.uber/explode
                  uber.clj:  257  clojure.tools.build.tasks.uber/uber/fn/fn
     PersistentVector.java:  343  clojure.lang.PersistentVector/reduce
                  core.clj: 6829  clojure.core/reduce
                  core.clj: 6812  clojure.core/reduce
                  uber.clj:  256  clojure.tools.build.tasks.uber/uber/fn
             protocols.clj:   49  clojure.core.protocols/iter-reduce
             protocols.clj:   75  clojure.core.protocols/fn
             protocols.clj:   75  clojure.core.protocols/fn
             protocols.clj:   13  clojure.core.protocols/fn/G
                  core.clj: 6830  clojure.core/reduce
                  core.clj: 6812  clojure.core/reduce
                  uber.clj:  254  clojure.tools.build.tasks.uber/uber
                  uber.clj:  241  clojure.tools.build.tasks.uber/uber
                  Var.java:  384  clojure.lang.Var/invoke
                   api.clj:  394  clojure.tools.build.api/uber
                   api.clj:  339  clojure.tools.build.api/uber
                      REPL:   78  build/eval8865
                      REPL:   78  build/eval8865
             Compiler.java: 7181  clojure.lang.Compiler/eval
             Compiler.java: 7136  clojure.lang.Compiler/eval
                  core.clj: 3202  clojure.core/eval
                  core.clj: 3198  clojure.core/eval
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  667  clojure.core/apply
                  core.clj: 1977  clojure.core/with-bindings*
                  core.clj: 1977  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn
                  main.clj:  437  clojure.main/repl/read-eval-print/fn
                  main.clj:  437  clojure.main/repl/read-eval-print
                  main.clj:  458  clojure.main/repl/fn
                  main.clj:  458  clojure.main/repl
                  main.clj:  368  clojure.main/repl
               RestFn.java:  137  clojure.lang.RestFn/applyTo
                  core.clj:  667  clojure.core/apply
                  core.clj:  662  clojure.core/apply
                regrow.clj:   20  refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   84  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   56  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  152  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  202  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  201  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  748  java.lang.Thread/run

2021-09-23T12:23:49.330500Z

I think it’s because this particular transitive dependency doesn’t have a corresponding jar; it just declares dependencies: https://repo1.maven.org/maven2/org/apache/jena/apache-jena-libs/3.17.0/

Alex Miller (Clojure team) 2021-09-23T12:32:12.332200Z

Yeah poms can't get added to the classpath. This is in here to catch unexpected stuff. Maybe we should just ignore poms

👍 1
2021-09-28T10:36:35.423600Z

Sorry to bother you, is there an issue for this?

2021-09-28T10:36:40.423800Z

I’m happy to create one

2021-10-12T13:34:00.494800Z

☝️ @alexmiller?

2021-10-12T13:35:26.495100Z

Summary of the issue: The problem manifests itself when building uberjars that contain deps whose pom.xml’s only reference dependencies (i.e. there is no corresponding jar for the classpath)

Alex Miller (Clojure team) 2021-10-12T13:36:50.495400Z

yes, please feel free now (and in every future case), to create a question on https://ask.clojure.org

2021-10-12T13:37:41.495700Z

Thanks — I’ll definitely do that in the future, I just wasn’t sure if you’d made an issue for it or not 🙇

Alex Miller (Clojure team) 2021-10-12T13:37:56.495900Z

I have not

Alex Miller (Clojure team) 2021-10-12T13:38:08.496100Z

even if I had, asking on ask would be ok :)

👍 1
2021-09-23T00:05:35.307300Z

@zulip-mirror-bot has joined the channel

logbot 2021-09-23T00:05:41.307500Z

@logbot has joined the channel