depstar

Discussion around https://github.com/seancorfield/depstar
2021-03-05T02:10:21.001700Z

@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 "<https://github.com/seancorfield/depstar>"
          :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}}}

2021-03-05T02:11:49.002700Z

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

&lt;groupId&gt;:group-id&lt;/groupId&gt;
  &lt;artifactId&gt;:artifact-id&lt;/artifactId&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;version&gt;:version&lt;/version&gt;

2021-03-05T02:13:19.003400Z

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

seancorfield 2021-03-05T02:29:55.004200Z

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

seancorfield 2021-03-05T02:30:22.004800Z

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

seancorfield 2021-03-05T02:30:56.005500Z

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

seancorfield 2021-03-05T02:39:39.006200Z

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

seancorfield 2021-03-05T02:48:17.007Z

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

(! 821)-&gt; clojure -Sforce -X:jar
Cloning: <https://github.com/seancorfield/depstar>
Checking out: <https://github.com/seancorfield/depstar> 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)-&gt; 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 "<https://github.com/seancorfield/depstar>"
          :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)-&gt; more pom.xml 
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;project xmlns="<http://maven.apache.org/POM/4.0.0>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" xsi:schemaLocation="<http://maven.apache.org/POM/4.0.0> <http://maven.apache.org/xsd/maven-4.0.0.xsd>"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;org.aircraft-noise&lt;/groupId&gt;
  &lt;artifactId&gt;util&lt;/artifactId&gt;
  &lt;version&gt;0.1.4-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;dcj/example&lt;/name&gt;

seancorfield 2021-03-05T02:52:17.007500Z

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

2021-03-05T03:04:13.007900Z

@seancorfield now it works! thank you!!!

mike_ananev 2021-03-05T20:01:17.011100Z

@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.

seancorfield 2021-03-05T20:03:36.011700Z

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

seancorfield 2021-03-05T20:04:05.011900Z

https://github.com/seancorfield/depstar/issues/7

seancorfield 2021-03-05T20:04:37.012400Z

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

ghadi 2021-03-05T20:08:09.013900Z

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

seancorfield 2021-03-05T20:14:21.014400Z

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

seancorfield 2021-03-05T20:14:59.015100Z

@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_ananev 2021-03-05T20:15:18.015700Z

Ok, thank you!

seancorfield 2021-03-05T20:15:26.015900Z

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

mike_ananev 2021-03-05T20:17:49.018100Z

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_ananev 2021-03-05T20:20:10.018900Z

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

mike_ananev 2021-03-05T20:20:36.019400Z

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

ghadi 2021-03-05T20:21:24.020100Z

I regularly run jlink without any module info

mike_ananev 2021-03-05T20:22:15.022Z

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

ghadi 2021-03-05T20:22:22.022400Z

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

seancorfield 2021-03-05T20:42:51.023200Z

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_ananev 2021-03-05T21:15:51.024200Z

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