Using a library from github not existing in mvn repository - scala

There is a Scala library for redis https://github.com/debasishg/scala-redis. It doesn't exist in mvnrepository.com. It's even not written at github how I must use it (add it as a dependency).
So how do I do that, how do I do add it as a dependency in my project?

If you look at the scala-redis' SBT Project file, it's recorded as redisclient. Searching for the same in maven sonatype, I get this result. Assuming you're using scala-2.10 - if not, you can see the list of released builds for other versions here.

Related

How to build a sdk in scala which can be reused in other projects

I am new to scala and programming and I have written a class in spark scala that is generic and should be reused by other projects. How can I build a sdk in scala sbt so that I can reuse this class without re writing the code again. Any online documentation would help.
What you're calling a "sdk" sounds more like what we call a "library".
The high level steps are:
create your library project (regular sbt project)
configure this project for publishing
publish the project to a repository (Artifactory, Nexus..) or optionally publish locally if you don't need a repository
in any other project, add your library project as a dependency
I would recommend reading the sbt documentation which should cover the most of it. For instance, Publishing with sbt.

Adding dependencies to eclipse

I want to use Choco 3.3.1 in my eclipse project. I added the needed jar file to the java build path. But in the readme file it says that I also need to add the required dependencies. They look like this:
org.javabits.jgrapht:jgrapht-core:jar:0.9.3
dk.brics.automaton:automaton:jar:1.11-8
args4j:args4j:jar:2.32
net.sf.trove4j:trove4j:jar:3.0.3
org.slf4j:slf4j-api:jar:1.7.13
Where can I add those without maven, gradle etc.?
(The project is a scala project, but I don't think that's the problem)
The easiest way is probably to locate and download them from the Maven Central repository. You can search by artifact and/or group ID and locate the exact version(s) you're looking for. For example, here's the search for the jgrapht JAR.
Having said that, why not use Gradle, which has Scala support? Or sbt, the Scala build tool? You should at least give those some consideration.

How do I retrieve the struts2-junit-plugin without using Maven?

I've googled on it and I've seen a lot of different sites that offers the struts2-junit-plugin.
I'm currently using struts-2.2.1.1. Should I get struts2-junit-plugin-2.2.1.1 as well?
Also, my project doesn't use Maven. When I downloaded a struts2-junit-plugin, I inspected the .jar file and found a pom.xml containing all of its dependencies. Should I separately download all these dependencies manually since I don't use Maven?
Yes, you should use the matching junit-plugin version (2.2.1.1)
Yes, but you also need to load the dependencies' dependencies, the dependencies' dependencies' dependencies ad nauseam until you're at the end.
Point 2 is why you really should be using Maven or similar mechanism.
Getting dependencies by hand is error-prone, tedious, and silly.

SBT: How to publish both the aggregate project and all modules on Sonatype?

I have a SBT project which I was publishing to Sonatype with no issue and I converted it to a multi-module SBT project. Now I want to:
publish the jar/javadoc/sources/pom file containing all the aggregated submodules to Sonatype
(meaning that they should be signed with the sbt-pgp plugin)
publish each individual submodule to Sonatype as well
I tried to use the sbt assembly plugin for this but didn't manage to get very far. Do you have a sample Build.scala file which would show what is the best structure to accomplish this?
I don't know if it's possible with currently available plugins, but using ScopeFilter, you might be able to create an artificial project that aggregates all sources, from there it's just the matter of calling publishSigned in there.
See how I aggregate source in sbt-unidoc.
Here's the proof of concept: https://github.com/eed3si9n/specs2/commit/18f6405c91cf995f621a84c65e05d66407ba4964
With the change I was able to run package, doc etc. You might have to aggregate *.class if you use macros.
I use the sbt assembly plugin for Casbah - https://github.com/mongodb/casbah
Casbah has a top level aggregate project but I also package a single all dependencies jar by adding an extra artifact to the build:
addArtifact(Artifact("casbah-alldep", "pom", "jar"), assembly),
See the build file for more info: https://github.com/mongodb/casbah/blob/master/project/CasbahBuild.scala

Using sbt as a library

sbt has a bunch of nice utils in (e.g.) sbt IO - I'd like to use these in my app. What are the artifact group/names/versions I should be referencing? (This is nearly impossible to Google for...) I looked in scala-tools.org but I could only find 2.7-compatible releases (and I'm building a 2.9 project) - am I out of luck? (For now I might try copying the relevant sources over into my project, if they're easy enough to tease apart and to port to 2.9.)
The groupId is org.scala-sbt as can be seen from https://github.com/harrah/xsbt/blob/0.12.1/project/Sbt.scala but apparently the latest artifacts are not available in a Maven repository. It might be best to build sbt yourself and install it into your local repository, or to just copy the source files into your project. The latest version of sbt (version 0.11) appears to use Scala 2.9.