Questions tagged [sbt-assembly]

1

votes
0

answer
205

Views

Sbt ( new version 1.0.4) assembly failure

I have been trying to build fat jar for some time now. I got assembly.sbt in project folder and it looks like below addSbtPlugin('com.eed3si9n' % 'sbt-assembly' % '0.14.6') and my build.sbt looks like below name := 'cool' version := '0.1' scalaVersion := '2.11.8' resolvers += 'Hortonworks Repositor...
ram
1

votes
1

answer
571

Views

Preserving Manifest.mf when building via sbt assembly

When I build my project using sbt assembly, I get java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF. The solution that google recommends, is to use MergeStrategy.discard. That works in getting the project to build - but it crashes at runtime, because Dropwizard (a dependency) relies...
Click Upvote
1

votes
1

answer
221

Views

SBT ignore repository proxy for ivy plugins

I've tried to follow the explanation to proxy ivy and sbt artifacts http://www.scala-sbt.org/1.x/docs/Proxy-Repositories.html Nevertheless, it looks like SBT just ignores my settings, This is my environemnt: Nexus 3.7.1 Several SBT versions (0.13.15 , 0.13.16, 1.0.0, 1.1.0) Several maven repositorie...
Y. Eliash
1

votes
0

answer
170

Views

how sbt merge strategy really works on deduplicate errors?

I'm new to sbt and sbt-assembly plugin. I tried to build 2 jars from different packages in the scala play project. I read the Merge Strategy section in https://github.com/sbt/sbt-assembly but still don't quite understand how the mapping of path names work. Could you please give me advise? I don't q...
David
1

votes
0

answer
39

Views

How to access resources generated by sbt?

Here's part of my build.sbt: Project(...)... .settings(..., resourceGenerators in Compile += myTask.taskValue, mappings in (Compile, packageSrc) += { ((resourceManaged in Compile).value / fileName) -> fileName } ) Basically, I want to load this file at runtime -- how do I do that/where do I lo...
allidoiswin
1

votes
0

answer
51

Views

issue to generate fat jar for the subproject in subpackage

I defined the subproject to create the fat jar for subpackage com.mycompany.proj.util. But the jar created (using sbt utilProject/assembly) only contains scala sdk classes and did not have the subpackage classes. Any ideas why? Do I need to specify the full path of the package? thanks lazy val utilP...
David
1

votes
1

answer
145

Views

compiling and running jars with scalac vs sbt?

I am trying to compile a fat jar for my Scala project that contains all of my dependencies according to this stackoverflow post, so that I can use it in a Java application. I am new to Scala/Java/JVM, so please be patient. I am using IntelliJ and scala 2.12.4, however I am running my sbt commands fr...
SnarkShark
1

votes
0

answer
143

Views

Why won't sbt-assembly shade json4s using inLibrary?

Using sbt-assembly 0.14.6: addSbtPlugin('com.eed3si9n' %% 'sbt-assembly' % '0.14.6') Creating an uber jar for a Spark app with sbt-assembly, including a couple dependencies to be shaded: libraryDependencies += 'org.json4s' % 'json4s-native_2.11' % '3.5.3', libraryDependencies += 'com.typesafe' % 'co...
Don Branson
1

votes
1

answer
111

Views

error: object sbtassembly is not a member of package <root>

I have build.sbt file as below ` import _root_.sbt.Keys._ import _root_.sbt.Keys._ import _root_.sbtassembly.Plugin.AssemblyKeys._ import sbtassembly.Plugin.AssemblyKeys import AssemblyKeys._ ` while building the project i am getting below error error: object sbtassembly is not a member of package...
Bharath Kumar
1

votes
0

answer
74

Views

Add git commit id in fat jar manifest using sbt

I am using sbt-assembly plugin to build a fat Jar for my scala project. Is there a way I can include git commit id in the jar manifest, something similar to what git-commit-id-plugin does for maven. Thanks
Abdul Rahman
1

votes
1

answer
49

Views

How do I do a multi-project build that outputs a jar for every subproject?

I have a project, called Main, and 2 subprojects: One, Two. Here's what my build.sbt looks like: name := 'Main' version := '0.1' scalaVersion := '2.12.7' lazy val root = Project(id = 'root', base = file('.')) aggregate(one, two) dependsOn(one, two) lazy val one = Project(id = 'one', base = file('On...
1

votes
1

answer
48

Views

sbt-assembly is not including scala libraries

The code I'm writing will be run in AWS Lambda which only has the Java 8 runtime installed so I need the scala libraries to be included in my jar. When I give it the jar I built with sbt-assembly I'm getting java.lang.NoClassDefFoundError: scala/Function3. This is all I have in build.sbt for the ass...
codenoodle
1

votes
0

answer
18

Views

sbt resolution taking too long

I have a Scala project which is built on a Jenkins farm. Sometimes the build takes a very short but somethings it takes too long to resolve. 00:02:26.699 [A[2K[0m[[0minfo[0m] [0mResolving org.objenesis#objenesis;2.6 ...[0m 00:02:46.700 [A[2K[0m[[0minfo[0m] [0mResolving org.objenesis#objenesis;2.6 .....
Behroz Sikander
1

votes
0

answer
34

Views

Sbt Dependency management [duplicate]

This question already has an answer here: How to build an Uber JAR (Fat JAR) using SBT within IntelliJ IDEA? 3 answers How to use sbt-assembly? 1 answer how do I get sbt to gather all the jar files my code depends on into one place? 7 answers Getting started using Sbt build tool for a Spark Proje...
Pavan_Obj
1

votes
1

answer
56

Views

Publishing split up assembly packages

I'm using sbt-assembly to publish artifacts. But I have added configuration split up artifacts into code and dependencies packages. The instructions on the sbt-assembly page mentions how to add assembly to the publishing phase. However I only get the -assembly-0.0.1-SNAPSHOT.jar published, not the -...
Magnus
1

votes
1

answer
835

Views

Create an executable jar for SBT scalatra webapp using Jetty [duplicate]

This question already has an answer here: Standalone deployment of Scalatra servlet 3 answers I wrote a small scalatra webapp using SBT. Webapp has default jetty plugin configured. Now i want to create an executable jar from that scalatra webapp which should run by simply executing the jar. I am tr...
Rajeev
1

votes
1

answer
161

Views

Using sbt-assembly for Newman, StackMob’s Http Client library

I need to use Newman, StackMob’s Http Client library in my Android project. I use sbt-assembly to generate one single (uber)jar with all dependencies. The command gives me a very big jar file (48mb) and Android can't convert it to dex. How can I add only needed dependencies to my jar library?
iCaesar
1

votes
2

answer
278

Views

sbt-assembly: prefix extracted files from some jars

In JOGL, there are lots of native jars for different OS x arch combinations. JOGL has several of its own mechanisms to load the right ones if you aren't using java.library.path, and supports a kind of 'fat jar' layout. In a fat jar layout, any native libraries need to be in a subdirectory ./natives/...
accumulator
1

votes
1

answer
308

Views

System.exit working in “sbt run” but not in .jar

When shutting down my program I need to let my akka actors finish what they're doing before shutting down, so I have a shutdown hook: sys.addShutdownHook( { log.info('\n shutting down startWorkScheduler\n') assignWorkScheduler.cancel() log.info('\ntelling manager to shutdown gracefully\n') manager !...
FelixHJ
1

votes
1

answer
82

Views

Calling a TaskKey with different settings

I'm using the plugin sbt-assembly (version 0.13.0), and I would like to call assemblyPackageDependency with or without appendContentHash depending on some InputKey Basically, I would like to do something like this: lazy val isGlobalCached = InputKey[Boolean]('') lazy val myTask = taskKey[sbt.File]('...
lev
1

votes
1

answer
340

Views

filter out unnecessary native dependencies during sbt-assembly

We are using sbt-assembly to merge our dependent jars into a single jar file. One of our dependencies contains native unmanaged dependencies for Windows, OSX and Linux. We will only be distributing on Linux. The native dependencies that we do not require are significantly increasing the size of our...
Hamish Smith
1

votes
1

answer
103

Views

Spray Application Run Against a Configuration

I have a Spray application that I would like to run against a different configuration file. In my resources folder, I have a set of configuration files as: resources application.conf application.integration.conf application.uat.conf With the Play framework, I normally put these files inside the conf...
sparkr
1

votes
1

answer
136

Views

Integrating nifi receiverwith Spark streaming causes sbt assembly to fail

I'm trying to create a Spark Streaming application using a nifi receiver. According to a tutorial, I added the sbt dependancies to my build file, but now sbt assembly is failing with a deduplicate error. My build.sbt file is: version := '0.0.1' scalaVersion := '2.10.5' libraryDependencies += 'org.ap...
mgaido
1

votes
1

answer
131

Views

sbt: avoiding multiple assembly / publish steps in java subproject

I have an sbt (0.13.8) project with several subprojects, most of them in pure Scala. They are cross assemblyed and published; crossScalaVersions := Seq('2.10.6', '2.11.8') releaseCrossBuild := true This works quite nicely so far. Now I am adding a Java subproject, which depends on some of the Scala...
mitchus
1

votes
1

answer
130

Views

Error running Kafka on Cloudera quickstart: assembly-package-dependency not valid

I have downloaded Kafka from apache and extracted it to its own folder. Following the quickstart, I also installed sbt, but at the third line in the sbt commands (I am launching the terminal from INSIDE the kafka folder, I get: [error] Not a valid command: assembly-package-dependency [error] Not a v...
Vale
1

votes
1

answer
211

Views

How to sequence sbt-assembly before custom task

I would like to define a custom task in my project build.sbt file. The assembly task from the sbt-assembly plugin returns the filename of each assembled jar. The custom task should wait until the assembly task has completed and use the list of file names to execute a shell script. Here's an idea of...
Darkphenom
1

votes
1

answer
478

Views

How to produce jar with sbt assembly without scala dependency

I have simple sbt project with one java class without scala dependency: package com.example; class Hello { public static void main(String[] args) { System.out.println('Hello World'); } } And build.sbt: name := '''test-sbt''' version := '0.1' scalaVersion := '2.11.8' mainClass in assembly := Some('co...
zella
1

votes
1

answer
189

Views

Scala.js cross-project wrong dependency

In my build.sbt I have a cross-project (js + jvm), and I depend on the jvm part in my other project (let’s call it events). Here’s the part of my build.sbt: lazy val common = (crossProject in file(“common”)).enablePlugins(ScalaJSPlugin) lazy val common_js = common.js lazy val common_jvm = co...
Haspemulator
1

votes
1

answer
222

Views

Specify jar structure in sbt assembly

When sbt-assembly builds a fat jar, it places all the dependencies in the main folder. I need to construct a jar that looks like this --domain domain classes -- lib dependency classes is it possible to do this with sbt assembly, or any other plugin?
Emma Pollum
1

votes
2

answer
112

Views

Ignoring subproject while building fat JAR of root project

I have a root project from which I want to build a fat JAR with sbt-assembly. It does have a subproject, which depends on root which I want to have ignored for the fat JAR (as if it didn't exist). How do I do this? Basically I want the root project packages as if there was no localMode subproject fr...
Make42
1

votes
1

answer
52

Views

ambiguous implicit values in scala-redis connector

I am trying to use Scala-Redis connector. Here is the code to establish connection. object RedisConnection extends Serializable { lazy val r: RedisClient = new RedisClient('localhost', 6379,5) } I defined the connection this way because I was getting 'task not serialisable error'. When I did printl...
Ravi Ranjan
1

votes
1

answer
448

Views

java.lang.ClassFormatError: Extra bytes at the end of class file

I generated a jar using sbt assembly but when I am trying to run the jar I am getting the below error. I am using scala 2.12.0, sbt 0.13.8 and assembly 0.14.2. Can anyone help me out what this error means and the resolution? Error: java.lang.ClassFormatError: Extra bytes at the end of class file
ArunavaS
1

votes
1

answer
314

Views

How to use different Spark version than as used in Cloudera's CDH cluster?

I use Cloudera cluster with Apache Spark 2.1.0.cloudera1 installed, but I need a new class from the latest commit from Apache Spark git repository: BlockMatrix.scala I just copy-pasted the whole file to my sbt scala project but I don't know how to create sbt-assembly MergeStrategy to exclude the clu...
fpopic
1

votes
1

answer
251

Views

How to access environment variables in sbt assembly jar?

I have an sbt project that spins up a server on a specified port. Here is related excerpt from build.sbt: port in container.Configuration := sys.env.getOrElse('MY_VAR_SEARCH_PORT', 8080).toString.toInt When I run the project from sbt, $MY_VAR_SEARCH_PORT gets picked up, and all is good. However, for...
Vasily802
1

votes
1

answer
199

Views

Why does sbt assembly of a Spark application lead to “Modules were resolved with conflicting cross-version suffixes”?

I am using CDH cluster with Spark 2.1 with Scala 2.11.8. I use sbt 1.0.2. While doing assembly, I am getting error as [error] java.lang.RuntimeException: Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml, org.scala-lang.modules:scala-parser-combinators I tried to override the v...
Kuldeep
1

votes
1

answer
42

Views

Are recompiled-from-source classes in Spark jars breaking sbt's merge?

Attempting to create a fat jar with sbt gives an error like this: java.lang.RuntimeException: deduplicate: different file contents found in the following: C:\Users\db\.ivy2\cache\org.apache.spark\spark-network-common_2.10\jars\spark-network-common_2.10-1.6.3.jar:com/google/common/base/Function.class...
Don Branson
1

votes
1

answer
21

Views

Attempts to test against a HiveContext when dependencies are provided throws java.lang.SecurityException

When running unit tests that create a spark context I get an java.lang.SecurityException. I understand what the cause is but not sure how to track down how to solve it. This being that multiple dependencies sharing the same package javax.servlet having different signer information. // Dependencies...
Brett Ryan
1

votes
1

answer
440

Views

Scala sbt-assembly, unable to get resource for org/pantsbuild#jarjar;1.6.5

I need to build fat executable jar. Using IntelliJ IDEA, scala (2.12.4), sbt (1.1.1) on Windows behind the proxy. Also, using http://babun.github.io/. Succeeded so far, except building fat jar using sbt-assembly. created project/assembly.sbt addSbtPlugin('com.eed3si9n' % 'sbt-assembly' % '0.14.6') c...
ajmnsk
1

votes
1

answer
235

Views

Build multi-project fat jars with sbt-assembly

I have multi-project with the main module called root, consumer and producer modules with dependencies which depend on the core module. The core modules hold configuration related classes. I would like to build 2 separate jars for consumer and producer with separate main classes with sbt-assembly....
Cassie
1

votes
1

answer
60

Views

Sbt fat jar (which excludes unused code)

So I've been trying to do some AWS lambda with scala and sbt. And one of the recommendations is Minimize your deployment package size to its runtime necessities. This will reduce the amount of time that it takes for your deployment package to be downloaded and unpacked ahead of invocation. For funct...
Vangogh500

View additional questions