GithubHelp home page GithubHelp logo

Comments (9)

angelcervera avatar angelcervera commented on July 4, 2024 8

Changed again to:
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)

from sbt-assembly.

liubov-dmitrieva avatar liubov-dmitrieva commented on July 4, 2024 1

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.

eed3si9n avatar eed3si9n commented on July 4, 2024

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.

ijuma avatar ijuma commented on July 4, 2024

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.

eed3si9n avatar eed3si9n commented on July 4, 2024

Now you can write

publishArtifact in (Assembly, packageScala) := false

from sbt-assembly.

ijuma avatar ijuma commented on July 4, 2024

Very cool, thanks!

from sbt-assembly.

matanox avatar matanox commented on July 4, 2024

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.

chadvoegele avatar chadvoegele commented on July 4, 2024

For anyone else who ends up here, the syntax changed to:
assembleArtifact in packageScala := false

from sbt-assembly.

radhe-kishan avatar radhe-kishan commented on July 4, 2024

What is the newer syntax for this?

from sbt-assembly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.