Importing a project from Git directly

40 views
Skip to first unread message

marcos rebelo

unread,
Jan 17, 2017, 4:09:29 AM1/17/17
to scala-user
Hi all,

I have this project (it is my first open source, Alpha at this point):
https://github.com/oleber/aws-stepfunctions

I have a second project that should import the first one. On the second project I did something like:

lazy val awsStepFunctions = RootProject(uri("git://github.com/oleber/aws-stepfunctions.git#31990fce907cbda3814954c390dcbc1b7807b2d5"))

lazy val importerWithStepFunction = project.in(file("modules/importerWithStepFunction"))
  .settings(global: _*)
  .dependsOn(
    awsStepFunctions % allScopes,
    commonCommons % allScopes,
    home24AWS % allScopes,
    importerBing % allScopes
  )


and I get an error like:

[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     ::          UNRESOLVED DEPENDENCIES         ::
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     :: default#aws-stepfunctions_2.11;1.0: not found
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]     Note: Unresolved dependencies path:
[warn]         default:aws-stepfunctions_2.11:1.0
[warn]           +- de.home24:importerwithstepfunction_2.11:0.1-SNAPSHOT


Clearly I'm missing something. Can you direct me to the solution or to documentation? I will work something.

Best Regards

Rafał Krzewski

unread,
Jan 17, 2017, 9:29:19 AM1/17/17
to scala-user
I don't think you can depend on sources of another project located in a remote git repository.

SBT supports dependencies between submodules of a single (root) project and supports dependencies on binaries (jars) available in Maven and Ivy repositories.

You should set organization property in build.sbt of your aws-stepfunctions project, let's assume organization := "oleber.github.com"
Then build the binary artifact and deploy it to your local repository on your machine by running sbt publishLocal in the working copy directory of aws-stepfunction project  
And finally add the following dependency to your "second project":
libraryDependencies ++= Seq(
"oleber.github.com" % "aws-stepfunctions" %% "1.0"
)

please note that "oleber.github.com" % "aws-stepfunctions" %% "1.0" is equivalent to "oleber.github.com" % "aws-stepfunctions_2.12" % "1.0" provided that binary scala version in the importing project is 2.12.

If you would like to make aws-stepfunctions publicly available, you should take a look at https://github.com/sbt/sbt-bintray and https://github.com/xerial/sbt-sonatype plugins.

Hope that helps,
Rafał

Lutz Huehnken

unread,
Jan 17, 2017, 11:36:56 AM1/17/17
to scala-user

Not an expert on this, but could it be the different Scala versions? oleber/aws-stepfunctions is Scala 2.12, the project you try to include it in seems to be 2.11 (guessing, as it's looking for a 2.11 artifact. I don't think sbt automatically crosscompiles the project you depend on to 2.11. If I were you, my first attempt would be to try if it works if both projects have the same Scala version (from the snippet of your build.sbt, I think it should).
Message has been deleted

Lutz Huehnken

unread,
Jan 17, 2017, 12:15:48 PM1/17/17
to scala-user

And me again, really sorry for the noise, last e-mail for today I swear!

So I had another realization, I was actually _not_ looking at the wrong commit, but at something else entirely. So I'm back to my theory about the version mismatch. Try it with 

lazy val awsStepFunctions = ProjectRef(uri("git://github.com/lutzh/aws-stepfunctions.git#63f95882c096197e29edd4694147b55c9b3109be"), "aws-stepfunctions")

Works for me. Further evidence: Delete your .sbt/0.13/staging/ dir. Run your broken build. Check .sbt/0.13/staging/ again - you'll probably find aws-stepfunctions_2.12 artifacts somewhere in there.

Hope this helps, sorry again for the prematurely sent last message. If I have another realization in a few minutes that this is all utter nonsense, I won't write again - someone else will please have to point that out then.

Lutz
Reply all
Reply to author
Forward
0 new messages