Configure repo for SBT launcher in Travis build - scala

Where can I override the repo URL that SBT uses to fetch its launcher when the SBT instance is provided by Travis-CI?
http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.8/sbt-launch.jar is currently giving 404s and, as a result, the builds are failing on Travis with:
$ sbt clean dependencyUpdates coverage test coverageReport
Detected sbt version 0.13.8
Downloading sbt launcher for 0.13.8:
From http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.8/sbt-launch.jar
To /home/travis/.sbt/launchers/0.13.8/sbt-launch.jar
Download failed. Obtain the jar manually and place it at /home/travis/.sbt/launchers/0.13.8/sbt-launch.jar

I ran into the same problem today, and logged an issue for travis-ci: https://github.com/travis-ci/travis-ci/issues/4527
As a workaround, you can download the sbt-launcher.jar by adding a before_script section to your .travis.yml
before_script:
- mkdir -p $HOME/.sbt/launchers/0.13.8/
- curl -L -o $HOME/.sbt/launchers/0.13.8/sbt-launch.jar http://dl.bintray.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.8/sbt-launch.jar

We just deployed the fix to production. SBT builds should be working now.
Sorry for the inconvenience.
https://github.com/travis-ci/travis-ci/issues/4527#issuecomment-124123880

Related

GitHub and Travis CI - How to fail build when tests fail

I have a Scala project on GitHub and I use the Travis CI to build it and show the resulting badge on the project home in GitHub. I started to write unit tests and I realized that during one of my commit, some tests failed. But the travis build shows that the build passes.
I know that I should be using some kind of hook to check for tests failures and correspondingly fail my build. But I just don't know what the correct command for that is? I could not as well infer this from any documentation.
Here is my travis.yml file:
language: scala
jdk:
- oraclejdk8
scala:
- 2.11.7
script:
- sbt clean coverage test coverageReport
after_success:
- bash <(curl -s https://codecov.io/bash)
What hook should I add here so that the build fails as soon as one of my unit test fails?

OPC UA Java Build Failures

I git cloned from the github UA-Java repository https://github.com/OPCFoundation/UA-Java to a folder UA-Java.
In the root of UA-Java, I ran
mvn package
Then, again from the root of UA-Java
mvn install
Finally,
in the examples\basic
mvn package
I got build failures for each of those. The last-parts of outputs are at here 1.
Could somebody help?
It looks like the tests are failing.
You can power through and ignore that by running mvn clean install -DskipTests at the root so it succeeds, then mvn package again in the examples to build your examples.
You might also consider opening an issue with the maintainers about the test failures if they're consistently failing.

IntelliJ with SBT plugin: Error Resolving [com.mycompany.mypackage]

I am trying to build a SBT based Scala project. The project has dependencies on packages on my company's local maven server. From within the company's network, I was able to compile/package(from cli and IntelliJ) the project successfully yesterday.
Today from home from command prompt, When I do:
sbt assembly
to build the repo it works fine.
But when I build from IntelliJ or do:
sbt compile|package
It is hitting the maven server and failing. My question is if the packages are already in the cache - ~/.ivy2/ then why maven server is hit. Is there a way to avoid server hit?
Doing a little search, found the answer
$ sbt "set offline := true" run

'Not a valid key' error from sbt-release build command

I installed the sbt-release plugin in my scala sbt project.
But when I run sbt release cross build or sbt release skip-tests, I get this error:
Not a valid key: cross (similar: crossPaths, crossTarget, cross-paths)
If you want to run release cross with-defaults or release skip-tests from the command line you need to quote it:
$ sbt 'release cross with-defaults'
$ sbt 'release skip-tests'
For some reason the release plugin doesn't play nice when you run it this way.
Try running sbt, then run release from within the console.

"Error during sbt execution: No Scala version specified or detected" with SBT from Homebrew

I have installed Scala 2.10.3 and SBT 0.13.1. When I execute SBT following Hello, World from the SBT documentation I get the following error message:
"Error during sbt execution: No Scala version specified or detected"
I've tried to add a build.sbt file with the scalaVersion but the error keeps showing up.
Please advise.
I've just downgraded sbt to 0.12.3 and it works ... so what's wrong with 0.13.X ?
Its not an issue with the upgrade of 0.13.* version. Its the repository cache thats causing the issue. There are possibilities where you have broken / no ivys (when only the jar is downloaded through maven repo) for the sbt jars in your cache.
Once upgraded remove your ivy repo cache (or rename the folder) and remove the .sbt/boot folder (removing this will enable to start from the scratch)
Edit your ./sbt/repositories file and provide preference to the ivy repositories. If you are using proxy repositories which includes both ivy and maven style artifacts, the add it as below
[repositories]
local
maven-local
maven-central-ivy: http://<repository url>, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
maven-central: http://<repository url>
This will enable especially (org.scala-sbt/sbt/*) to be download with the Ivys xml from where the version / revision and dependencies are picked up for the builds. If only the jar is downloaded from "maven-central", then the error occurs.
It is the problem of IDE you are using specially the scala plugin in it.
You can get ride of this just go to the folder where the build.sbt is created. Delete the "project" folder and open cmd, run "sbt" command on the folder, a new project folder will be created. Now you can open that in IDE.
It may be that you may find some problem very first in ide, if you build the project once , all the problems will go away.
I did exactly what #Gopi proposed but this is my repositories file content:
[repositories]
local
jcenter: https://jcenter.bintray.com/
maven-central
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
My SBT Version: 1.1.1
java version 1.8
Windows 10
Hope that helps,
BR. Paul
I've also installed both Scala and SBT on my machine through homebrew and can just run the given simple hello example, so i guess you did something wrong :-)
Please provide a bit more diagnostics, for example:
What is the output of both commands 'which sbt' and 'which scala'?
You should see the results as below:
$ which scala
/usr/local/bin/scala
$ which sbt
/usr/local/bin/sbt
$ ls -laF /usr/local/bin/sbt
lrwxr-xr-x 1 rjk admin 28 Feb 9 13:32 /usr/local/bin/sbt# -> ../Cellar/sbt/0.13.1/bin/sbt
$ ls -laF /usr/local/bin/scala
lrwxr-xr-x 1 rjk admin 32 Feb 9 13:38 /usr/local/bin/scala# -> ../Cellar/scala/2.10.3/bin/scala
And given the directory where you ran the example code from, is it completely empty besides the hw.scala example? Or did you also add the build.sbt or project/build.properties? If that's the case it would be wise to also list that here to spot any problems with them.