Short introduction: Simple-build-tool plugin with Eclipse in 5 Minutes on Youtube (demo of one of the first versions) or look at the test project. Please, open test
file
What is it? You may fetch SBT project artifacts, compose jars with source code, align sources inside jars for your favorite IDE
It is provide an ability:
- to fetch all dependency jars (include sbt-dependency-manager itself) to target folder
- to fetch all dependency jars with sources (include sbt-dependency-manager itself) to target folder
- to fetch all dependency jars with sources, merge them (include sbt-dependency-manager itself) and save to target folder
If you want to improve it, please send mail to sbt-android-mill at digimead.org. You will be added to the group. Please, feel free to add yourself to authors.
SBT source code is really simple to read and simple to extend :-)
This readme cover all plugin functionality, even if it is written in broken english (would you have preferred well written russian :-) Please, correct it, if you find something inappropriate.
Create a
- project/plugins/project/Build.scala - for older simple-build-tool
- project/project/Build.scala - for newer simple-build-tool
file that looks like the following:
import sbt._
object PluginDef extends Build {
override def projects = Seq(root)
lazy val root = Project("plugins", file(".")) dependsOn(dm)
lazy val dm = uri("git://github.com/sbt-android-mill/sbt-dependency-manager.git#0.6.1")
}
You may find more information about Build.scala at https://github.com/harrah/xsbt/wiki/Plugins
Then in your build.sbt file, simply add:
sbt.dependency.manager.Plugin.activate
You may find sample project at src/sbt-test/dependency-manager/simple
resolvers += Resolver.url("digimead-ivy", url("http://storage.googleapis.com/ivy.repository.digimead.org/"))(Resolver.defaultIvyPatterns)
resolvers += "digimead-maven" at "http://storage.googleapis.com/maven.repository.digimead.org/"
By default aligned jars saved to target/deps Change dependenciesPath at your project to something like
dependenciesPath <<= (target in LocalRootProject) map { _ / "my-align-dir" }
or
dependenciesPath <<= (baseDirectory) (_ / "my-aling-dir")
By default sbt-dependency-manager skip "org.scala-lang" and "org.scala-sbt". If you need all dependencies do
dependencyFilter := Seq()
dependencyFilter <<= (dependencyClasspathNarrow) map { cp =>
val filter1 = moduleFilter(organization = "org.scala-lang")
val filter2 = moduleFilter(organization = "org.other")
val filter3 = moduleFilter(organization = "com.blabla")
Some(cp.flatMap(_.get(moduleID.key)).filterNot(filter1).filterNot(filter2).filterNot(filter3))
},
More about module filters look at SBT Wiki
-
Download all project and SBT dependencies, sources, javadocs
-
Merge code jars with sources
-
Align sources inside jars
SBT task name
> dependency-fetch-align
It is very useful to develop simple-build-tool plugins. Most SBT source code are unaligned. Original sources saved in root directory of jar, but it binded to different packages. This situation prevent source code lookup in most common situations. This is very annoying. SBT *-sources.jar was mostly useless in development before sbt-dependenc-manager ;-)
> set dependencyPath <<= baseDirectory map {(f) => f / "123" }
> dependency-fetch-with-sources
- dependency-path (dependencyPath) - Target directory for dependency jars
- dependency-filter (dependencyFilter) - Processing dependencies only with particular sbt.ModuleID
- dependency-add-custom (dependencyAddCustom) - Add custom(unknown) libraries to results
- dependency-classpath-narrow (dependencyClasspathNarrow) - Union of dependencyClasspath from Compile and Test configurations
- dependency-classpath-wide (dependencyClasspathWide) - Union of fullClasspath from Compile and Test configurations
- dependency-ignore-configurations (dependencyIgnoreConfigurations) - Ignore configurations while lookup, 'test' for example
- dependency-fetch - Fetch project jars. Save result to target directory
- dependency-fetch-align - Fetch project jars, merge them with source code. Save result to target directory
- dependency-fetch-with-sources - Fetch project jars, fetch source jars. Save result to target directory
Simple-build-tool plugin with Eclipse in 5 Minutes on Youtube
HD quality Simple-build-tool plugin with Eclipse in 5 Minutes - 60,5Mb
Developing simple SBT plugin in Eclipse IDE with
- autocomplete
- sources lookup
- debug SBT tasks in Eclipse debugger (I asked about debugging in SBT mailing list, but no one can answer. I suspect that others people for debug sbt plugins used print or s.log.debug. lol ;-) )
- implicit lookup
- types lookup
- refactoring support
... and bunch of other standard features
PS sbt-dependency-manager obsoletes capabilities provided by sbt deliver-local + IvyDE or sbteclipse plugin
- I want to fetch artifacts, but SBT try to compile broken code. Process aborted with compilation error.
sbt> set dependencyClasspathNarrow <<= dependencyClasspath in Compile
sbt> set dependencyClasspathWide <<= dependencyClasspath in Compile
- Alexey Aksenov
The sbt-dependency-manager is licensed to you under the terms of the Apache License, version 2.0, a copy of which has been included in the LICENSE file.
Copyright © 2012-2013 Alexey B. Aksenov/Ezh. All rights reserved.