I am trying code coverage analysis using sbt-scapegoat package but I am getting the below error
Extracting structure failed, reason: not ok build status: Error
(BuildMessages(Vector(),Vector(BuildFailure(sbt task failed, see log
for details)),Vector(),Vector(),Error)) sbt task failed, see log for
details
maybe it because of some dependency issue
sbt version
1.5.8
build.sbt
ThisBuild / scalaVersion := "2.12.7"
coverageEnabled := true
// https://mvnrepository.com/artifact/org.scalatest/scalatest
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % Test
plugins.sbt
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("com.sonar-scala" % "sbt-sonar" % "2.3.0")
addSbtPlugin("com.sksamuel.scapegoat" % "sbt-scapegoat" % "1.1.1")
NOTE:- I have referred to this link and tried for all possible versions from 1.1.0 to 1.4.11
plz help to understand the error
Thanks in advance.
Related
I am trying to get my build.sbt working, but when I press reload all sbt projects in Intellij it fails:
Extracting structure failed: Build status: Error sbt task failed, see log for details
My build.sbt:
scalaVersion := "2.12.17"
name := "hello-world"
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % "2.1.1",
"com.microsoft.azure" % "spark-mssql-connector_2.12" % "1.2.0",
"org.apache.spark" % "spark-core_2.12" % "3.1.3",
"org.apache.spark" % "spark-sql_2.12" % "3.1.3"
)
I am trying with this configuration since I want to try the Apache Spark Connector for SQL Server and Azure SQL. (https://github.com/microsoft/sql-spark-connector)
Anyone know why it fails? I don't get any details.
When I comment "org.apache.spark" % "spark-sql_2.12" % "3.1.3" the build is successful.
I have a Scala sbt project which I am trying to run on my IntelliJ but I am facing exception as:
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/Module
I have included the dependency in my build.sbt as
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.12.1"
Can someone let me know what is missing?
I also thought may be it needs some dependency related to scala so I added though I am not sure of this but still same error
// https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-scala
libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.3"
Any suggestions anyone?
This Error is happened when your code depends on some class ( in your case jackson.databind.Module) but java cannot find it when trying to compile because dependency address is not passed to Java as argument, if you have added the proper dependencies in your build.sbt file, try this in IntelliJ:
sbt reload (in your application terminal or sbt shell)
File > Invalidate cache and restart
Just updates the project and indexes the project and dependencies so updates the compile and running command, which might fix your problem.
Resolved by adding
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-core" % "2.10.5"
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.5"
dependencyOverrides += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.10.5"
to build.sbt file.
I am new to scala. I am trying to create a scala project in IntellIj and adding a test class.
I am using the below 2 dependencies in sbt.
libraryDependencies += ("org.scalactic" %% "scalactic" % "3.0.8")
// https://mvnrepository.com/artifact/org.scalatest/scalatest
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % Test
But I am unable to use the class FunSuite in the test class 'ProcessCSVTest.scala' for testing as it is giving a compilation error.
Although I can see the dependencies in the external library in my IntellIj
Build.sbt file
name := "CSVParser"
version := "0.1"
scalaVersion := "2.13.0"
libraryDependencies += ("org.scalactic" %% "scalactic" % "3.0.8")
// https://mvnrepository.com/artifact/org.scalatest/scalatest
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % Test
The entire code can be found here - https://github.com/practice09/CSVParser
Can anyone please tell me where I am doing wrong?
One issue is the test ProcessCSVTest.scala is under main sources which means ScalaTest needs to be on the main classpath, however in build.sbt ScalaTest dependency is scoped to the Test classpath
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % Test
So if you remove Test scope like so
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8"
then ScalaTest will end up on the main classpath and we can add the following import
import org.scalatest.FunSuite
However my suggestion is to move the tests out of the main sources and put them under src/test/scala/, and then scope the dependency under Test like before
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % Test
The following command builds an example with correct project structure expected by sbt
sbt new scala/scala-seed.g8
so try exploring how it is setup and fit your project to match.
Because FunSuite is in a package, you need to add
import org.scalatest.FunSuite
If you put the cursor on it and press Alt+Enter, you should get a suggestion to fix it.
I updated my play to 2.6.0. I have a kamon dependency but sbt can't resolve this dependency.
Did anyone encounter this problem too?
Below is my libraryDependencies in the build.sbt:
libraryDependencies +=
Seq(
ws,
"com.google.inject" % "guice" % "3.0",
"com.typesafe.play" %% "play-json" % "2.6.0",
"io.kamon" %% "kamon-play-26" % "0.6.7"
)
But I get a below error as kamon-play-26 not found...
Kamon for Play 2.6 is available for Scala 2.11 and 2.12 with:
"io.kamon" %% "kamon-play-2.6" % "0.6.8"
Note the period in 2.6.
Searching through the kamon repositories in maven reveals that there is no kamon-play-26 package.
The github page https://github.com/kamon-io/kamon-play indicates that it does exist however. Perhaps its been pulled because the build is failing. Compile your own package from source, perhaps?
I am currently trying to setup a play scala project buildchain with travis, heroku and coveralls sbt plugin for codecoverage.
I have created a clean scala play app with the activator and just added the coveralls plugin and a travis.yml.
When I push my project and trigger the build I get the following exception while travis runs the tests:
[error] c.g.h.h.HtmlPage - Error loading JavaScript from [http://localhost:19001/assets/javascripts/hello.js].
java.io.IOException: Unable to download JavaScript from 'http://localhost:19001/assets/javascripts/hello.js' (status 404).
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1106) ~[htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1039) ~[htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:409) [htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:266) [htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:286) [htmlunit-2.13.jar:2.13]
I have found this old topic (https://groups.google.com/forum/#!topic/play-framework/yj4NT3BO0Os) with the same errormessage but unfortunately none of the solutions there worked for me.
Does anyone here use coveralls or know a solution for my problem? I ve attached all configuration files.
build.sbt
import scoverage.ScoverageSbtPlugin.instrumentSettings
import org.scoverage.coveralls.CoverallsPlugin.coverallsSettings
name := """buildchain"""
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.1"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws
)
instrumentSettings
CoverallsPlugin.coverallsSettings
ScoverageKeys.minimumCoverage := 1
ScoverageKeys.failOnMinimumCoverage := true
plugins.sbt:
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += Classpaths.sbtPluginReleases
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.5")
// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")
// code coverage
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "0.99.7.1")
addSbtPlugin("org.scoverage" %% "sbt-coveralls" % "0.99.0")
travis.yml
language: scala
scala:
- 2.11.2
script: "sbt coveralls"
notifications:
email: false
The issue is with sbt-scoverage and has been fixed in release 1.0.0. Please note that you have to update the way you use the plugin, so refer to the setup guide on the readme.
https://github.com/scoverage/sbt-scoverage
The error says you are getting an HTTP 404 (Not Found) error:
java.io.IOException: Unable to download JavaScript from 'http://localhost:19001/assets/javascripts/hello.js' (status 404)
so I'm thinking this isn't so much a problem with your tools but just simply a plain old "not found" issue. Do you have an assets/javascripts/hello.js file in your project?
It seems that this is an issue with the sbt-scoverage plugin and play. I hope that this issue will be resolved in the future...
https://github.com/scoverage/sbt-scoverage/issues/52