sbt

Why is there a build.gradle and a build.sbt in play framework?

纵然是瞬间 提交于 2020-01-14 07:28:41
问题 I'm starting to develop a web app with scala. What I don't understand is why we have a build.gradle file and a build.sbt file. There are dependencies defined in both files. Which one should I use in what case? 回答1: The files are equivalent, and that is why they both declare (almost) the same dependencies. So you can use Gradle or sbt, but you won't need to use both. If you want to use Gradle, just remove build.sbt . If you want to use sbt, just remove build.gradle . They are both present in

what does pomOnly() do in .sbt files?

别来无恙 提交于 2020-01-14 07:24:07
问题 what does pomOnly() do in .sbt files? For example, "com.github.fommil.netlib" % "all" % "1.0" pomOnly() 回答1: Indeed, SBT reference guide does not seem to provide much info about pomOnly() . As per mvnrepository, the dependency "com.github.fommil.netlib:all" corresponds to an aggregate pom.xml: <dependency> <groupId>com.github.fommil.netlib</groupId> <artifactId>all</artifactId> <version>1.0</version> <type>pom</type> </dependency> The call of pomOnly() in build.sbt indicates to the dependency

How to extract dependency jar to specific folder during compilation?

99封情书 提交于 2020-01-14 05:45:26
问题 These are my project's dependencies: libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, javaWs, "com.company" % "common_2.11" % "2.3.3" ) In com.company.common_2.11-2.3.3 there is a jar file common_2.11-2.3.3-adtnl.jar . How can I during compilation process in build.sbt tell SBT to extract its contents to specific folder in my project? 回答1: Use the following in build.sbt : def unpackjar(jar: File, to: File): File = { println(s"Processing $jar and saving to $to") IO.unzip(jar, to) jar }

sbt assembly error encontered during merge

空扰寡人 提交于 2020-01-14 04:08:45
问题 I try to create a fat jar using sbt assembly and I get the following error: [warn] Merging 'org\eclipse\persistence\descriptors\copying' with strategy 'rename' [warn] Merging 'META-INF\MANIFEST.MF' with strategy 'discard' [warn] Merging 'META-INF\maven\commons-logging\commons-logging\pom.properties' with strategy 'discard' [warn] Merging 'META-INF\maven\commons-logging\commons-logging\pom.xml' with strategy 'discard' [warn] Merging 'META-INF\maven\javax.validation\validation-api\pom

sbt 0.11.2: use only corporate nexus repository for dependencies

戏子无情 提交于 2020-01-14 03:33:07
问题 I am trying to setup an sbt instance installed with the typesafe stack to only use my private nexus repository for all of the dependencies. But no matter what I try, the dependencies are downloaded from http://repo.typesafe.com/typesafe/releases. I have tried many solutions and especially the ones explained here, here and here. I have even tried to change the sbt.boot.properties inside the sbt-launch.jar but with no luck. Is there something special in the typesafe stack that prevents from

sbt-assembly: Rename Class with merge conflicts (shade)

血红的双手。 提交于 2020-01-13 16:47:30
问题 How can I tell sbt-assembly to keep its existing merge / deduplicate rules, except, when two .class files conflice, rename (and issue a warning so I know about it)? Would this be identical to the shade strategy used in Maven? 回答1: The rename strategy literally just renames the file and it doesn't change the contents, so it won't work for .class files. The main use case for rename is for LICENSE files. Updated in September 2015 : sbt-assembly 0.14.0 adds shading support. sbt-assembly can shade

Is there a way to get all dependencies of the project via sbt plugin?

给你一囗甜甜゛ 提交于 2020-01-13 02:44:22
问题 I want to write an sbt plugin, and inside it I need to get the list of all dependencies of current project (with some info, is possible). Is it possible? 回答1: In our project we use the update task to get the library dependencies: (update) map { (updateReport) => updateReport.select(Set("compile", "runtime")) foreach { srcPath => /* do something with it */ } } Hope this helps for a start. [EDIT] Here is a simple example how to add this functionality to your task: val depsTask = TaskKey[Unit](

sbt-proguard with play 2.2.3

随声附和 提交于 2020-01-12 18:53:31
问题 We developed a web application with play 2.2.3 and want to obfuscate it. I am trying to use sbt-proguard plugin. I put the line below to PROJECT_FOLDER/project/plugins.sbt file addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2") and put the lines below to PROJECT_FOLDER/build.sbt file proguardSettings ProguardKeys.options in Proguard ++= Seq("-dontnote", "-dontwarn", "-ignorewarnings") ProguardKeys.options in Proguard += ProguardOptions.keepMain("Application") inConfig(Proguard)

SBT how to run InputTask

二次信任 提交于 2020-01-12 18:51:50
问题 I am creating some custom tasks in my SBT project and need to call other tasks for that. How can i call inputTasks from inside my tasks and support them some input? 回答1: Since you can factor your own tasks around this I'm assuming you're trying to use the run task. It took a bit of digging, but I've finally made it work; in a nutshell, this is what you do (assuming your task is named deployTask , tweak to match your needs): deployTask <<= ( fullClasspath in Compile, runner ) map { ( classpath

IntelliJ cannot resolve symbol in build.sbt

你说的曾经没有我的故事 提交于 2020-01-12 04:53:08
问题 IntelliJ IDEA 15 is reporting an unresolved symbol for my project definition in my build.sbt file lazy val root = (project in file(".")).enablePlugins(PlayScala) It's reporting an error with project and in . Cannot resolve symbol project. Cannot resolve symbol in. Everything else resolves perfectly and the project is otherwise all set up, sbt builds fine, activator runs fine. 回答1: To fix this issue, I imported: import sbt.project on top of my build.sbt I am working with IntelliJ IDEA 16 EAP