Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mariussoutier/sbt-unpack

sbt unpack plugin
https://github.com/mariussoutier/sbt-unpack

sbt sbt-plugin scala unzip

Last synced: 18 days ago
JSON representation

sbt unpack plugin

Awesome Lists containing this project

README

        

# sbt-unpack

Simple plugin to unpack JARs in your project. Loosely based on ideas presented in Josh Suereth's book
[sbt in Action](https://www.manning.com/books/sbt-in-action)
[Chapter 7](https://github.com/jsuereth/sbt-in-action-examples/blob/master/chapter7/website/build.sbt)
and packaged into an auto plugin.

## Installation

Add this to `plugins.sbt`:

```
addSbtPlugin("com.mariussoutier.sbt" % "sbt-unpack" % "0.9.5")
```

## Usage

First, enable the plugin on the project you want to use it with.

```scala
lazy val root = project(...)
.enablePlugins(com.mariussoutier.sbt.UnpackPlugin)

```

Then run `unpackJars` manually or execute it automatically by adding to a generator, for example:

```scala
import com.mariussoutier.sbt.UnpackKeys
// Unpacks whenever you compile
sourceGenerators in Compile += UnpackKeys.unpackJars
// Or if you want to execute another task after unpacking
sourceGenerators in Compile += Def.sequential(UnpackKeys.unpackJars, ...).taskValue
```

## Configuration

| Key | Description |
| --------------------------- | ------------------------------------------------------------- |
| `dependenciesJarDirectory` | Location of the unpacked dependency JARs |
| `dependencyFilter` | Which dependencies to unpack |
| `fileExcludeFilter` | Files inside the JARs that should be excluded while unpacking |

Example:

```scala
import com.mariussoutier.sbt.UnpackKeys
import NameFilter._
.settings(
UnpackKeys.dependencyFilter := { (fileName: String) => fileName.startsWith("example-") },
)
```