Comments (9)
Changed again to:
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
from sbt-assembly.
I need to exclude scala if I am compiling for running my jar with spark and leave it if I will run locally.
Is there a better way than to comment / uncomment the line every time? Something like introduce custom parameter for sbt assembly?
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
from sbt-assembly.
You can still override the existing behavior by rewiring the keys in Assembly scope.
excludedFiles in Assembly := { (base: Seq[File]) =>
((base / "scala" ** "*") +++
(base / "spark" ** "*") +++
((base / "META-INF" ** "*") ---
(base / "META-INF" / "services" ** "*") ---
(base / "META-INF" / "maven" ** "*"))).get }
from sbt-assembly.
I thought that this was a common enough requirement that it should be supported in the plugin, but fair enough if you disagree.
I should add that I tried your solution and it doesn't work. I haven't investigated much, but since the settings for the plugin are appended to the project's settings automatically, they won't be overridden. Personally, I think the settings should not be added automatically (like the web plugin). This way the user can choose what projects in the multi-module build need this task. For example, for spark, adding the dependency on sbt-assembly breaks the build in the examples project even though we don't care about assembly for that project. If you're interested in the error, it's:
[info] Packaging /media/internal0/home/ijuma/idea-workspace/spark/repl/target/repl-assembly-0.4-SNAPSHOT.jar ...
[error] {file:/media/internal0/home/ijuma/idea-workspace/spark/}core/:assembly: java.util.zip.ZipException: duplicate entry: spark/broadcast/BitTorrentBroadcast$PeerChatterController$$anonfun$run$1.class
[error] {file:/media/internal0/home/ijuma/idea-workspace/spark/}repl/:assembly: java.util.zip.ZipException: duplicate entry: spark/repl/JLineCompletion$JLineTabCompletion.class
[error] {file:/media/internal0/home/ijuma/idea-workspace/spark/}examples/:assembly: java.util.zip.ZipException: duplicate entry: spark/MesosScheduler$$anonfun$resourceOffer$1.class
[error] {file:/media/internal0/home/ijuma/idea-workspace/spark/}bagel/:assembly: java.util.zip.ZipException: duplicate entry: spark/broadcast/BitTorrentBroadcast$TrackMultipleValues$$anonfun$run$19.class
[error] {file:/media/internal0/home/ijuma/idea-workspace/spark/}root/*:assembly: No mapping for /media/internal0/home/ijuma/idea-workspace/spark/target/scala-2.9.0.1/classes
from sbt-assembly.
Now you can write
publishArtifact in (Assembly, packageScala) := false
from sbt-assembly.
Very cool, thanks!
from sbt-assembly.
Thanks this capability is really helpful, although, with the most current sbt release:
error: overloaded method value in with alternatives:
(p: sbt.Reference,t: sbt.Scoped)sbt.SettingKey[Boolean] <and>
(p: sbt.Reference,c: sbt.ConfigKey)sbt.SettingKey[Boolean] <and>
(c: sbt.ConfigKey,t: sbt.Scoped)sbt.SettingKey[Boolean]
cannot be applied to (sbtassembly.Assembly.type, sbt.TaskKey[sbt.File])
publishArtifact in (Assembly, packageScala) := false
Probably the sbt syntax has since changed
from sbt-assembly.
For anyone else who ends up here, the syntax changed to:
assembleArtifact in packageScala := false
from sbt-assembly.
What is the newer syntax for this?
from sbt-assembly.
Related Issues (20)
- Inconsistent merge strategy logging vs counts
- Logback does not work with รผber-JAR HOT 1
- Migrate to `com.github.sbt`? HOT 1
- Assembly no longer creating directories defined in assemblyOutputPath HOT 4
- executable jar args
- Concatenating files without a newline HOT 4
- META-INF/javax.annotation.processing.Processor is included empty when shading is enabled - log4j HOT 1
- Add setting to allow adding arbitrary files to output Jar HOT 1
- Merge error not comprehensible HOT 3
- Definition of a repeatable build HOT 1
- InvalidPathException on Assembly 2.1.1 HOT 13
- Current alternative to assembledMappings HOT 6
- Document log4j2 plugins custom merge strategy HOT 2
- sbt clean assembly fails
- issue with zip64 headers in jars generated using sbt-assembly HOT 1
- Files from project's sources overwrite merged dependencies (2.0.0 regression)
- Shading breaks META-INF/services (1.2.0 regression) HOT 1
- Exception thrown "pomProperties" is null
- Abort build if shading fails HOT 1
- question about Mappings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbt-assembly.