Fork me on GitHub
#depstar
<
2021-03-05
>
dcj02:03:21

@seancorfield I just tried it, and it didn't work. My deps.edn-fu is weak, and maybe I didn't follow your docs correctly, here is a snippet from my deps.edn:

:aliases
 {
  :artifact-id ["util"]
  :group-id    ["org.aircraft-noise"]
  :version     ["0.1.4-SNAPSHOT"]

  :jar {:replace-deps
        {com.github.seancorfield/depstar ; 2.0.next:
         {:git/url ""
          :sha "a8cf78c9e09e3504e64fc77bcb133a7ada39a68f"}}
        :exec-fn hf.depstar/jar
        :exec-args {:jar "util.jar"
                    :artifact-id :artifact-id
                    :group-id :group-id
                    :version :version
                    :sync-pom true}}}

dcj02:03:49

the resulting pom.xml contains the literal keyword values eg.

<groupId>:group-id</groupId>
  <artifactId>:artifact-id</artifactId>
  <packaging>jar</packaging>
  <version>:version</version>

dcj02:03:19

changing the alias keywords to e.g. :artifact/id did not help

seancorfield02:03:55

@dcj Did you use -X:jar as the alias for running depstar?

seancorfield02:03:22

Also the three aliases you have are vectors -- but those are not legal values for those exec args.

seancorfield02:03:56

:artifact-id util
:group-id   org.aircraft-noise
:version    "0.1.4-SNAPSHOT"
^ Those are valid

seancorfield02:03:39

Hmm, yeah, something isn't right with that... let me debug...

seancorfield02:03:17

My bug. It worked for some options but not for all of them. Fixed now! See the new SHA here:

(! 821)-> clojure -Sforce -X:jar
Cloning: 
Checking out:  at ee2badaaf4b26754f903ed92e77fd4e82cf2ed70
[main] INFO hf.depstar.uberjar - Synchronizing pom.xml
Skipping paths: resources
[main] INFO hf.depstar.uberjar - Building thin jar: util.jar
[main] INFO hf.depstar.uberjar - Updating pom.xml file to {org.aircraft-noise/util {:mvn/version "0.1.4-SNAPSHOT"}}
[main] INFO hf.depstar.uberjar - Processing pom.xml for {org.aircraft-noise/util {:mvn/version "0.1.4-SNAPSHOT"}}
(! 822)-> cat deps.edn 
{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.2"}}
 :aliases
 {
  :artifact-id util
  :group-id    org.aircraft-noise
  :version     "0.1.4-SNAPSHOT"
  :jar {:replace-deps
        {com.github.seancorfield/depstar ; 2.0.next:
         {:git/url ""
          :sha "ee2badaaf4b26754f903ed92e77fd4e82cf2ed70"}}
        :exec-fn hf.depstar/jar
        :exec-args {:jar "util.jar"
                    :artifact-id :artifact-id
                    :group-id :group-id
                    :version :version
                    :sync-pom true}}}
}
(! 823)-> more pom.xml 
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation=" ">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.aircraft-noise</groupId>
  <artifactId>util</artifactId>
  <version>0.1.4-SNAPSHOT</version>
  <name>dcj/example</name>

seancorfield02:03:17

Thanks for trying it out and catching that bug before I released it @dcj !!!

dcj03:03:13

@seancorfield now it works! thank you!!!

mike_ananev20:03:17

@seancorfield What was the reason to delete module-info.class when building uberjar by depstar? I'm trying to build custom image using jlink, which want the module-info.class inside uberjar.

seancorfield20:03:36

I don't remember the details on that one. I'd have to hunt through the commits.

seancorfield20:03:37

So maybe @ghadi has some more insight into why that is an issue?

ghadi20:03:09

App vs Lib You don’t want to put a module descriptor in an uberjar, but you do want to put it in a module jar

seancorfield20:03:21

Ah, interesting. So that exclusion should be dependent on the JAR type then? I had no idea.

seancorfield20:03:59

@mike1452 Feel free to create a GH issue about it. I'll be cutting a new release probably over the weekend and I can get the fix into that.

mike_ananev20:03:18

Ok, thank you!

seancorfield20:03:26

But it sounds like an uberjar should not have that file, based on what @ghadi just said.

mike_ananev20:03:49

It is interesting. My case: I made an uberjar and I want to run it in docker image. In order to reduce a size of docker container I want run jlink to reduce size of JDK image. jlink produces custom JDK image based on classes which requires uberjar.

mike_ananev20:03:10

it seems that jar lib should not have that file, but uberjar should.

mike_ananev20:03:36

well I've found workaround so it is not critical for me.

ghadi20:03:24

I regularly run jlink without any module info

mike_ananev20:03:15

I use this articel https://www.devdungeon.com/content/how-create-java-runtime-images-jlink I want to create a custom launcher using jlink.

ghadi20:03:22

It’s not necessary unless you want autodetection, which won’t help because Clojure libs are ignorant of modules

seancorfield20:03:51

If y'all figure out depstar's behavior should be changed, just open a GH issue with deets 🙂 Sounds like "not" at this point?

mike_ananev21:03:51

@seancorfield Yes, "not" at this point. I've found trivial workaround.