Skip to content

Commit cef5f32

Browse files
authored
Merge pull request sbt#521 from eed3si9n/wip/readme
Parasitized über JAR
2 parents 6fad7b6 + be3b11e commit cef5f32

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

README.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -548,21 +548,15 @@ lazy val app = (project in file("app"))
548548

549549
### Publishing (Not Recommended)
550550

551-
Publishing über JARs out to the world is discouraged because non-modular JARs cause much sadness. One might think non-modularity is convenience but it quickly turns into a headache the moment your users step outside of Hello World example code. If you still wish to publish your assembled artifact along with the `publish` task
552-
and all of the other artifacts, add an `assembly` classifier (or other):
551+
We discourage you from publishing non-shaded über JARs beyond deployment. The moment your über JAR is used as a library, it becomes a **parasitized über JAR**, bringing in parasite libraries that can not be excluded or resolved. One might think non-modularity is convenience, but it turns into others' headache down the road.
553552

554-
```scala
555-
assembly / artifact := {
556-
val art = (assembly / artifact).value
557-
art.withClassifier(Some("assembly"))
558-
}
553+
Here are some example of parasitized über JARs:
559554

560-
addArtifact(assembly / artifact, assembly)
561-
```
555+
- hive-exec 2.3.9 and 3.1.3 contain com.google.common, com.google.protobuf, io.airlift, org.apache.parquet, org.codehaus.jackson, org.joda.time, etc.
562556

563557
### Q: Despite the concerned friends, I still want publish über JARs. What advice do you have?
564558

565-
You would likely need to set up a front business to lie about what dependencies you have in `pom.xml` and `ivy.xml`.
559+
Shade everything. Next, you would likely need to set up a front business to lie about what dependencies you have in `pom.xml` and `ivy.xml`.
566560
To do so, make a subproject for über JAR purpose only where you depend on the dependencies, and make a second cosmetic subproject that you use only for publishing purpose:
567561

568562
```scala
@@ -576,7 +570,6 @@ lazy val uberJar = project
576570
lazy val cosmetic = project
577571
.settings(
578572
name := "shaded-something",
579-
// I am sober. no dependencies.
580573
Compile / packageBin := (uberJar / assembly).value
581574
)
582575
```

0 commit comments

Comments
 (0)