kevinjoeiy
kevinjoeiy

Reputation: 121

ScalaStyle using grade return an error

I'm looking for scalaStyle using gradle. Can you explain how to do it?

I've tried this link, but I get an error:

Error:(110, 0) Could not find method scalaStyle() for arguments [build_5ig236mubh10t6rxyt8apdkfi$_run_closure4@46b9e954] on root project .....

Upvotes: 0

Views: 746

Answers (1)

Opal
Opal

Reputation: 84854

Here's is a sample build.gradle that uses scalaStyle plugin:

buildscript {
  repositories {
    maven {
      url 'http://jcenter.bintray.com/'
    }
  }
  dependencies {
    classpath 'org.github.ngbinh.scalastyle:gradle-scalastyle-plugin_2.11:0.9.0' //version 1.0.0 is not published yet.
  }
}

apply plugin: 'scalaStyle'

scalaStyle {
  configLocation = '/path/to/scalaStyle.xml'
  includeTestSourceDirectory = true
  source = 'src/main/scala'
  testSource = 'src/test/scala'
}

You need to define buildscript block to declare dependencies for the script itself. When it's done a plugin needs to be applied. Finally you can use scalaStyle block to configure the plugin's behaviour.

Upvotes: 0

Related Questions