The main added value of this plugin is to use properties files to replace placeholders in your ivy.xml before SBT parses it.
##Features
If you don't care about property placeholder replacement, you won't need this plugin. Please check Ivy settings activation to know how to use ivy configuration files with SBT.
-
you can define properties that will replace any placeholder defined in ivy.xml. The placeholder has to follow the format "${variable.name}" with the value being defined in your project.properties or build.properties (the later overriding the former).
-
placeholders can be nested. This means that your property file (project.properties or build.properties) can contain properties under the format
prop1=value1 - ${prop2} prop2=value2
where "${prop1}" will be resolved to "value1 - value2" in your ivy.xml.
##Pre-requisites
- a global ivyconf.xml containing Ivy settings is accessible locally.
- the directory where to find ivyconf.xml must be defined as a property in a project.properties located in your project root. The file must define the property common.build.dir, e.g.:
# common.build.dir contains the ivyconf.xml containing the Ivy settings common.build.dir=/Users/me/git/common-build
- your ivy.xml must define a "sbt-test" configuration which will extend your default, compile and test configurations.
- [optional] if you use JUnit for your tests, you might want to add the junit-interface dependency to the "sbt-test" configuration.
##How to configure SBT to compile and test your Ivy project
To use the plugin, create a ./project/plugins.sbt containing
lazy val root = (project in file(".")).dependsOn(sbtivy) lazy val sbtivy = uri("git:https://github.com/matthieus/sbt-ivy/#v1.0")
(binaries currently not hosted, forks for customization encouraged)
Then create a sbt configuration file which can be either:
- a build.sbt in your project root path containing:
import sbtivy._ // imports the plugin content name := "my-project" ivyBuildSettings(".") // appends the ivy specific settings to your project
or
- a ./project/Build.scala containing:
import sbt._
import Keys._
import sbtivy._ // imports the plugin content
object build extends Build {
lazy val myProject = Project(id = "my-project",
base = file("."),
settings = Defaults.defaultSettings ++
ivyBuildSettings(".") // appends the ivy specific settings to your project
)
}
##SBT will now give you the ability to
- compile: useful for ~compile, but ~test is more useful.
- test: this plugin was especially created to have ~test and ~testOnly path.to.test.class work.
What about running the project? Untested, but it might work.
##Fitting your specific needs
In case your ivy settings file is not called ivyconf.xml or you have a set of ivy configurations that is not default, compile and test, I invite you to create your own fork.
##Bugs and Requests
Please use Github issue management tool.
##License
sbt-ivy is licensed under the terms of the Apache Software License v2.0.
##Copyright
Unless otherwise noted, all source files in this repository are Copyright (C) Bizo, inc. 2014