Skip to content

bogdanromanx/sbt-nexus

 
 

Repository files navigation

Join the chat at https://gitter.im/BlueBrain/nexus Build Status GitHub release

SBT Nexus Plugin

The plugin provides a collection of sbt auto plugins that configure a project with reasonable defaults for most sbt based scala nexus projects.

Please visit the parent project for more information about Nexus.

Getting Started

Add the necessary resolver:

resolvers += Resolver.bintrayRepo("bbp", "nexus-releases")

Add the following line to your project/plugins.sbt file:

addSbtPlugin("ch.epfl.bluebrain.nexus" % "sbt-nexus" % "M.m.p")

Plugins

CompilationPlugin

The CompilationPlugin defines all the settings related to compilation. It has no dependencies and is set to trigger automatically.

Exposed setting keys:

  • javaSpecificationVersion (java-specification-version): java version to be used for source and target compatibility
  • scalacCommonFlags (scalac-common-flags): common scalac options useful to most projects
  • scalacLanguageFlags (scalac-language-flags): language options to enable
  • scalacStrictFlags (scalac-strict-flags): a collection of stricter compilation flags (i.e.: -Xfatal-warnings)
  • scalacOptionalFlags (scalac-optional-flags): useful additional flags (i.e.: -Ypartial-unification)

The plugins automatically sets the scalaVersion to 2.12.9, the javaSpecificationVersion to 11 and checks during the initialization phase if the installed jdk is compatible with the target java version. It also appends to the scalacOptions all the flags defined in the exposed settings and sets the necessary compiler flags for both javac and scalac to generate bytecode compatible with the defined javaSpecificationVersion.

ReleasePlugin

The ReleasePlugin configures the release process using for sbt-release-early plugin.

Additional exposed setting keys:

  • dependencyBlacklist (dependency-blacklist): a module filter for stripping out compile time only dependencies from the resulting pom file.

The plugin hooks into the pomPostProcess task and removes the dependency xml nodes that match the filter defined by the dependencyBlacklist. The filter is currently configured to strip out coverage and static analysis dependencies (scoverage and scapegoat).

StaticAnalysisPlugin

The StaticAnalysisPlugin pulls into the project default settings for the ScapegoatSbtPlugin. Run the following task for static analysis: scapegoat.

CoveragePlugin

The CoveragePlugin pulls into the project default settings for the ScoverageSbtPlugin:

  • require at least 80% code coverage
  • fail the build if the coverage target is not met

To enable code coverage measurement issue the coverage command and run the tests. To compute the resulting coverage run the coverageReport task.

To disable code coverage measurement issue the coverageOff command.

To produce an aggregate coverage report for multi-module builds run the coverageAggregate task.

Note: make sure to disable code coverage measurement and recompile the project before attempting to run or publish the project to ensure that the produced bytecode is not instrumented for coverage.

DocumentationPlugin

The DocumentationPlugin defines settings and an utility to facilitate cross linking scala documentation when comments contain references to types that have documentation (scala doc) published online.

If scala doc comments contain references to types in dependent libraries and the project is not configured with the correct mapping (artifactId -> url) attempting to build the doc will fail if the link warnings are not suppressed (the setting to suppress these warnings is defined under the suppressLinkWarnings key and defaults to true).

Adding an external documentation reference based on an artifactId and enabling link warnings:

import ch.epfl.bluebrain.nexus.sbt.nexus.DocumentationPlugin.apiMappingFor
import sbt.Keys._

lazy val myProject = project.settings(Seq(
  suppressLinkWarnings := false,
  apiMappings          += {
    val scalaDocUrl = "http://scala-lang.org/api/" + scalaVersion.value + "/"
    apiMappingFor((fullClasspath in Compile).value)("scala-library", scalaDocUrl)
  }
))

The default configuration automatically adds the scala library documentation url to the apiMappings.

InstrumentationPlugin

This plugin adds aspectj and sigar loader as java agents to all apps packaged with universal packaging.

NexusPlugin

Generic auto plugin to define arbitrary Nexus specific settings that don't deserve their own separate plugin. It currently configures the default organization for all artifacts.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%