Fork me on GitHub
#depstar
<
2021-07-10
>
seancorfield04:07:03

@wilkerlucio not quite sure what you're asking, or what that has to do with depstar?

wilkerlucio04:07:26

maybe I'm confusing something, but I just started using depstar, coming from Leiningen, there lein used to put the <scm> tag automatically in the pom.xml. in the case of depstar I'm letting depstar generate the pom.xml, then I though it may have some option on depstar to add the <scm> when generating the pom.xml

wilkerlucio04:07:02

so, what I should do is add it to the pom.xml directly?

seancorfield05:07:01

If you use clj-new to create a project, it creates a complete pom.xml from a template -- depstar uses the CLI to generate a pom.xml so it is very minimal.

seancorfield05:07:54

I could replicate clj-new's pom.xml template into depstar I guess, rather than use the CLI/tools.deps.alpha to generate it.

wilkerlucio13:07:43

makes sense, I did the manual changes and everything goes smooth now, thanks!

2
Eddie18:07:54

Is there a way to configure depstar to exclude entire deps (and their transitive deps) from an uberjar? I am trying to get the same functionality of the “provided” maven scope. I have some maven deps that are required at compile-time, but should not be included in the uberjar because they will be provided by the runtime environment that my application is deployed into. I tried using :exclude with a regex that matches the name prefix of the direct dependency that I want to exclude but the transitive dependencies of that dep are still included in the uberjar.

seancorfield21:07:33

You could use an alias that contains just the deps you need in the jar.

👍 3
awb9921:07:16

I am trying to generate a jar that contains the dependencies of a :local/root sub-project. depstar includes the source code, but does not include the dependencies of the sub-project. What am I doing wrong? Thanks!

seancorfield21:07:10

@hoertlehner Are you trying to build a (thin) JAR or an uberjar?

awb9921:07:49

a thin jar

awb9921:07:18

I want to release a derived jar that only includes a few extra dependencies

awb9922:07:10

clojure -Spom gives me this warning: Skipping coordinate: {:local/root /home/andreas/pinkgorilla/goldly, :deps/manifest :deps, :deps/root /home/andreas/pinkgorilla/goldly, :parents #{[]}, :paths [/home/andreas/pinkgorilla/goldly/src /home/andreas/pinkgorilla/goldly/resources /home/andreas/pinkgorilla/goldly/target/webly]}

awb9922:07:18

this is for te subproject

seancorfield22:07:07

Thin JARs never include transitive dependencies.

awb9922:07:55

so then I guess I need to move the extra deps to the main project, and then use alias flag in depstar to include them?

awb9922:07:47

many thanks for the info on thin jars.

awb9922:07:59

I would never found out about that iin the docs.

seancorfield22:07:20

Sorry, I guess it's an assumption that folks know the difference between a (thin) library JAR and an uberjar and so that is out of scope for depstar's documentation... but I guess adding a section explaining that wouldn't hurt... https://github.com/seancorfield/depstar/issues/93

awb9922:07:30

is there any way to add extra-deps from an alias to the jar with depstar?

awb9922:07:02

#!/bin/sh # create pom, including :bundel deps clojure -Spom -A:bundel # add git tag to pom (do not modify git tag) #clojure -M:garamond -t minor #clojure -M:garamond -t clojure -M:garamond:bundel -p # garamond removes deps from :bundel, so we # have to run pom generation again clojure -Spom -A:bundel #create jar clojure -X:jar:bundel :aliases '[:bundel]'

awb9922:07:23

I need in te jar the version number from git. I use garamond for that

awb9922:07:43

-Spom adds all the deps from the alias to the pom

awb9922:07:59

:jar goes to depstar

awb9922:07:13

both garamond and depstar remove all extra deps from :bundel alias

seancorfield22:07:11

"is there any way to add extra-deps from an alias to the jar with depstar?" -- yes, read the docs for the :aliases and :compile-aliases options to depstar. But, again, thin JARs will never contain transitive dependencies (nor should they).

seancorfield23:07:08

What you want is those transitive dependencies as actual dependencies in your own project, so they end up in your pom.xml when sync'd.

awb9923:07:24

so in thin jars ONLY the main dependencies of deps.edn appear as dependencies of te jar?

awb9923:07:49

so I guess tat I have to auto-generate a drived deps.edn file.

awb9923:07:31

I need to publish a derivation of my project that contain just a few extra dependencies.

awb9923:07:49

the subproject option is perfect, because it works in development

seancorfield23:07:54

Thin JARs are intended as libraries and should not contain anything but the library. The pom.xml file should declare what dependencies the library needs.

awb9923:07:04

but to release the subproject it does not seem to work.

awb9923:07:33

I guve an example:

awb9923:07:58

I want one version to be released with jetty the jar called superduper-jetty

seancorfield23:07:06

Even bundling those other :local/root projects could cause problems -- which is why depstar has a :paths-only option to make it not do that.

awb9923:07:20

another version with httpkit, jar called superduper-httpkit

seancorfield23:07:31

You should not release a JAR containing other libraries.

seancorfield23:07:16

If you are releasing an application that is intended to be self-contained, that would contain the dependencies. But not a library JAR.

seancorfield23:07:37

(but an application is expected to be runnable without needing anything but java)

awb9923:07:52

I release a library.

awb9923:07:03

but I need to do variations of it.

seancorfield23:07:48

For a library, any dependencies it needs should simply be declared in its pom.xml file, not included in the JAR.

awb9923:07:46

I would like to keep the additional deps in a deps.edn file. tis way I can use the clojure tools to check for outdated versions, etc.

awb9923:07:47

but many many thanks @U04V70XH6

awb9923:07:07

knowing tst thin jars can not do it helps me a lot already!!!

awb9923:07:31

i have thought that my usecase is more common.

seancorfield23:07:01

Just remember that a library's dependencies are declared in the pom.xml that is deployed with it (and should match the one inside it). So you can probably use different aliases in your deps.edn file to represent the different sets of dependencies you want each of your deployed library versions to have, and then you would generate/sync the pom.xml file from deps.edn with the appropriate aliases and deploy it with that generated pom.xml file -- and of course you'll need a unique group/artifact ID pair for each variant. With :target-dir (new in the most recent depstar), you could probably arrange to do this, specifying :aliases, :group-id, :artifact-id, :sync-pom true, and an appropriate :pom-file option (for the source pom.xml to use).

seancorfield23:07:51

But the key point here is that your "variants" should be just about the pom.xml file you produce -- the JAR won't contain anything from those dependencies.

awb9923:07:48

yes, this is exactly what I am trying to do.

awb9923:07:05

but depstar removes the deps from the alias in the thin jar.

awb9923:07:43

I do not want to include the jars, but I want to include them as necessary dependencies i the pom.xml

seancorfield23:07:41

It isn't depstar removing them, it's tools.deps.alpha -- I can see what you mean now (I was focused on the issue of actual dependencies in the JAR before). Let me try something...

seancorfield23:07:51

Yeah, that shouldn't happen. I'll have to dig into how t.d.a is doing that sync, but I thought it would reflect the :aliases specified as an option to depstar 😐

awb9923:07:12

In my experiments the depsar :aliases are not going to the pom.

awb9923:07:24

But I could have fucked it up somewhere.

seancorfield23:07:26

Can you just confirm which version of depstar you are using?

seancorfield23:07:26

I can get the aliases to be included with just clojure -A:some-alias -Spom but it doesn't seem to work programmatically -- so I'll have to dig into that difference over the next few days.

awb9900:07:24

yes, generating the pom with  `clojure -A:some-alias -Spom`  works

awb9900:07:43

#!/bin/sh # create pom, including :bundel deps clojure -Spom -A:bundel # add git tag to pom (do not modify git tag) #clojure -M:garamond -t minor #clojure -M:garamond -t clojure  -M:garamond:bundel -p # garamond removes deps from :bundel, so we # have to run pom generation again clojure -Spom -A:bundel #create jar clojure -X:jar:bundel  :aliases '[:bundel]'

awb9900:07:15

I posted my batch file, because both garamond and depstar ignore the -A flags

awb9900:07:06

so I tried first generating pom file , then using garamond to add git tag version to pom, then running clojure pom generatuin AGAIN so the deps would be in te pom

awb9900:07:47

Unfortunately I cannot do the same trick with depstar because ten I would have to manually edit the jar file.

seancorfield00:07:42

If you do not sync the pom, depstar will take it as-is -- try :sync-pom false (or just remove that option, it should default to false).

awb9901:07:36

I will try tomorrow

awb9901:07:39

many thanks

seancorfield16:07:27

@hoertlehner This is fixed in depstar 2.1.253 -- but I need to discuss my workaround with Alex re: tools.deps.alpha behavior as this may be a bug in t.d.a

awb9922:07:24

so it should work now also with sync-pom ?

seancorfield22:07:39

Yup, it does, based on my tests. And the t.d.a issue does seem to be a bug.

awb9923:07:42

amazing! thank you so much!

seancorfield16:07:27

@hoertlehner This is fixed in depstar 2.1.253 -- but I need to discuss my workaround with Alex re: tools.deps.alpha behavior as this may be a bug in t.d.a