The scala-tools Maven Repo Change: sbt Broken - scala

Yesterday, the Typesafe repo (at http://scala-tools.org/repo-releases) appeared to be down. Today, the page says it is being 'sunsetted' in favor of being served from Sonatype. Problem is that my just installed version of sbt (from homebrew on a mac) is still looking at the old repo and it's failing with:
[info] Resolving com.eed3si9n#sbt-assembly;0.8.0 ...
[warn] module not found: com.eed3si9n#sbt-assembly;0.8.0
Changing the repo URLs for the project is simple: found that in Build.scala. But that does me no good because the assembly jar not being found is coming up before the build of the project gets triggered (inferring this). Then I found this thread here about having to explode the jar.
Ok, I fixed this by getting a resolvers definition from the sbt-assembly github readme. However, my question is, why is 0.8.0 of sbt-assembly not on the new sonatype repo??
New Releases Repo

Eugene simply hasn't pushed sbt-assembly up to Sonatype yet. More importantly, you're running with an outdated version of SBT. The Scala Tools hosting was never provided or supported by Typesafe. Rather, it was a service provided to the community by David Pollak (the creator of Lift). He has since decided to withdraw his involvement in the community, including the hosting for Scala Tools. This is why the repository is in "sunset mode". The latest versions of most Scala build tools (including SBT) no longer point to Scala Tools.
My advice would be to first upgrade to a newer version of SBT. Second, file an issue on sbt-assembly prodding Eugene to take the necessary steps to get the project into Sonatype's repositories.

Related

Remove scala version from publishing path

I'm trying to deploy my sbt plugin to azure artifacts. Sbt adds the scala version to publishing path like in:
https://pkgs.dev.azure.com/orgname/projectname/_packaging/feed/maven/v1/com/test/plugin-name_2.12_1.0/0.0.1-SNAPSHOT/plugin-name-0.0.1.pom
Azure artifacts replies with a 400. I'm quite sure that's because of the added scala version. Is there a way remove the scala version from the path?
I read the documentation, looked up examples, but didn't find a solution.

SBT in a non-Ivy environment

I work for a java shop and we use JFROG artifactory.
I am trying to use Scala and SBT, but I see everyone doing Scala projects prefers to use maven with scala plugin.
I want to know what settings, configuration, I need to do in a SBT project so that it disables IVY altogether and my builds interact with the JFROG server just like maven would.
I figured out the answer. it is documented here
http://www.scala-sbt.org/0.13/docs/Using-Sonatype.html

I have made an scala library but how can I release it to maven, sonatype or other

How can I release a jar to an artifactory and which do you recommend, is there a guide or tutorial to use with sbt, thanks.
There is an SBT plugin that simplifies the workflow for you - sbt-sonatype. Check this github project and just follow the steps described there.
This project is an example that uses the sbt-sonatype plugin.

How to build JGit in Eclipse (dependency errors)

I'm trying to build the latest version of JGit. I checked out the latest version from the Git repository. According to the build instructions, I installed the dependencies via Orbit. I then ran mvn clean install which was able to compile everything and run all the tests. So this was great, there were no errors, and I can find the compiled .jar files.
I then opened Eclipse and imported the projects into a working set. For some reason, there are numerous errors in the build process.
Imports cannot be resolved:
import org.apache.commons.compress.archivers.ArchiveOutputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.archivers.tar.TarConstants;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
And more cannot be resolved:
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
I tried installing Jetty via Eclipse (Install New Software). However, that did not resolved the issue.
Am I just not supposed to build JGit in Eclipse? All builds and testing should be done with Maven? I'm also confused as to why Jetty and Apache are being imported in some of these subprojects for JGit and they're not listed as dependencies of JGit on the wiki.
Thanks in advance.
The easiest way to install the dependencies is to use one of the target platforms, as described in Use a Target Platform. It includes all dependencies.
As for installing from the Orbit P2 repository, the listing there was incomplete. You also need to install "Apache Commons Compress", see updated instructions:
http://wiki.eclipse.org/EGit/Contributor_Guide#Option_2:_Install_from_Orbit_P2_Repository
Jetty can not be installed from Orbit, see here for instructions:
http://wiki.eclipse.org/EGit/Contributor_Guide#JGit_HTTP_Tests
Or again, use the target platform where Jetty is also included.
The Jetty and Compress libraries are used by part of the JGit infra, but the EGit support in Eclipse doesn't need everything that JGit has.
For example, JGit also provides a collection of command-line programs (jgit init, jgit add etc.) which are not used in Eclipse. So you need to build the 'pgm' module from MAven, but that in itself isn't used by EGit which is the UI in Eclipse. Similarly, the JGit HTTP server is useful but not required for EGit operation.
I believe the archivers are used to extract out tools via the pgm module for 'jgit archive', which extracts out the contents of a branch and generates a Zip or TGZ file on the fly.
If you don't want (or need) the pgm module (and i'd suggest possibly also avoiding the iplog as well) then you can uncomment those from the list of modules in the pom.xml file. Removing the http.server (and http.test) along with the pgm modules will probably allow you to compile without needing the Jetty and Apache compress modules.

Setting up a Scala Lift project in Eclipse

I'm trying to set up my first scala lift project in Eclipse and it is Not Simple (TM).
What I have done is set up the project trough Maven with the following
mvn archetype:generate -U \
-DarchetypeGroupId=net.liftweb \
-DarchetypeArtifactId=lift-archetype-basic_2.9.1 \
-DarchetypeVersion=2.4-SNAPSHOT \
-DarchetypeRepository=http://scala-tools.org/repo-releases \
-DgroupId=demo.helloworld -DartifactId=helloworld -Dversion=1.0-SNAPSHOT
I then created an eclipse project from this with mvn eclipse:eclipse (because it's hellish to figure out all the dependencies, and add them all to the build path manually)
The project then conflicts with the installed Scala version. So I removed the three existing references to scalalang from the buildpath, and added my own scala to the buildpath. I'm using scala 2.9.0.
Now the project can be built, but when I try to run RunWebApp, an exception is thrown:
Exception in thread "main" java.lang.NoClassDefFoundError: RunWebApp
Caused by: java.lang.ClassNotFoundException: RunWebApp
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: RunWebApp. Program will exit.
I'm aware of the answer on Scala-Lift project in Eclipse Scala IDE errors suggesting to ask the question on http://groups.google.com/group/scala-ide-user yet I hoped someone here could point me to the answer in a way someone else with the same problem might find the answer too
I advice you to use lift with sbt. You can find template project here https://github.com/viktortnk/lift-quickstart with sbt 0.11.2 and lift 2.4
It also includes sbt eclipse plugin to work in scala-ide.
I hope it will help you.
I find if you use sbt 0.11 and the sbteclipse plugin, it does all the magic for you.
https://github.com/harrah/xsbt
https://github.com/typesafehub/sbteclipse
I know this question is old, but it comes up in the search results pretty high, so I wanted to add an updated answer.
The latest Scala IDE (2.1 M3) is getting quite good, as are the maven integrations. I have an open-source demo project at:
https://github.com/awkay/lift_squeryl_demo
that gives instructions on getting eclipse set up with the following features:
Simply Import a lift project based on this pom (which uses Scala 2.9/Lift 2.5) As "Existing Maven Project". Done. Nothing else to run. No sbt files to generate. No eclipse project files to generate...it just works.
Great scala support, including highlights on implicits, great source level debugging
Web tools server support (run/debug your webapp in the servers tab of eclipse)
JRebel support for on-the-fly class reloading (there is a free license for this!)
Typical maven support for command-line builds and packaging
The ability to any number of Java webapps on the same tomcat instance, in cases where you have to deal with integration among apps.
The result is an experience that requires no command line interaction at all, and includes super-fast edit-save-reload web development. It really gives you the dynamic language development experience.
I don't know if this is the problem you're having, but sometimes you need to make sure the Scala library appears before the JRE library in the project classpath (or run configuration used to execute it).
http://www.assembla.com/spaces/scala-ide/tickets/1000119-classnotfoundexception-trying-to-run-scala-app-in-helios