Pathikrit Bhowmick | 20 Nov 19:26 2014
Picon

Dynamically load user defined code from plugin?

Reposted on SO: http://stackoverflow.com/questions/27024934/sbt-plugin-dynamically-load-user-defined-code

I am working on a sbt plugin that generates Scala models given a database using Slick code generator

I would ofcourse want users to override the code generator so my plugin needs to support this:

  • Anyway I can dynamically load a Scala class given a path to it in the build.sbt plugin keys? For example, in the user's parent build.sbt, she would provide something like codegen.override=com.company.project.CustomCodegenerator which looks like this

  • Related to above; the custom codegen may use some other libraries so a simple dynamic class load may not suffice. Anyway an sbt plugin can inherit the dependencies of the project using that plugin?

Here is the full discussion about this: https://github.com/papauschek/play-slick-evolutions-plugin/issues/1


--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
Piyush Mishra | 18 Nov 09:27 2014
Picon

Is there any workaround for generating SWF client files using sbt aspectJ plugin

Hi All,

I am using SWF in sbt project. But i am getting problem in generating swf 
client classes. Is there any workaround for this. 

sbt problem with kafka test jar

Hello,

I am currently trying to get both the Kafka 0.8.1.1 and the Kafka 0.8.1.1-test library to get downloaded and used by sbt.

In my build.sbt I have the followin lines:

  "org.apache.kafka"  %% "kafka" % "0.8.1.1" withSources(),
  "org.apache.kafka"  %% "kafka" % "0.8.1.1-test" withSources(),

and:
scalaVersion := "2.10.4"

The strange thing is that sbt does not seem to download the test jar. when I use 0.8.7.5 (which does not exist!) sbt reports an error but when I use "test-XYZ" no error is reported. The library does exist:


Does sbt somehow ignore the text after the version number, meaning does it turn "0.8.1.1-test" into "0.8.1.1"?

Any idea what I am doing wrong?

Regards,

Markus






--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.

Prasad Ganta | 15 Oct 15:24 2014
Picon

How to resolve dependencies through proxy repository

Hello guyz,

please answer this question even if it is looking dumb...

I have some dependencies in my Build.scala file and by default all the dependencies are getting resolved from mave/typesafe public repo.
so far I dont have any issues, now I want to resolve all my public or internal dependencies through private repository which is hosted on internal server.

Here what I did so far

- I went through    sbt documentation on  http://www.scala-sbt.org/0.12.2/docs/Detailed-Topics/Proxy-Repositories.html 
- Currently we are using Artifactory as our proxy server, so I prepared artifactory to download required dependencies from various public repos.
- Added resolvers in Build.scala like below

 resolvers := Seq("snapshots" at "http://hostedurl/artifactory/libs-snapshot-local/",
        "typesafe-cache" at "http://hostedurl/artifactory/typesafe",
        "snapshots" at "http://hostedurl/artifactory/ext-release-local",
        " repo1-cache" at "http://hostedurl/artifactory/repo1")

Now the problem

It is not resolving the dependencies through above urls, it is resolving with default repo urls comes with sbt.

as per the document I needs to make some changes to ~/.sbt/repositories I am not able to find the files mentioned in the document(Ia m using windows machine)

Can anyone please help me with the above issue.


Thanks
Prasad 

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
Daniel Sobral | 24 Oct 03:44 2014
Picon

Keys in .sbt files

SBT 0.13.6 now makes keys defined on .sbt files visible from SBT console.

However, it seems, and TODOs on the relevant commit seems to confirm it, that keys defined in this fashion are not visible from _other_ build.sbt files.

We use keys to set libraries present in multiple projects to the same version in all of them, so having a key visible from multiple files is essential for us.

Are there plans to have this implemented? Is there an issue tracking it, or should I open one?

--
Daniel C. Sobral

I travel to the future all the time.

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
Rishi Khandelwal | 10 Oct 06:45 2014

Error during sbt test execution: java.lang.NoClassDefFoundError: scala.Option with ScalaTest

Hello

When I am running my project with "sbt compile" or "sbt run" or scala test from eclipse (via downloading scala test plugin in eclipse), it runs fine. there is no error at all.

But when i do "sbt test" , it throws the error : java.lang.NoClassDefFoundError: scala.Option

I searched on google as well and i found that scala-library.jar is not added to classpath. I am not getting proper solution for this.

sbt version : 0.13.2

Please put your thoughts here.

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
des.magner | 20 Sep 13:34 2014
Picon

Setting a jvm option with xsbt-plugin

Hi

I want to pass an environment variable when running container:start from sbt. So I have tried adding

 javaOptions in container := Seq("-Dmyvar=xxx")

to my build.scala, as outlined in the xsbt plugin documentation. But this is having no effect when I run container:start. Can someone suggest what I might be missing?

Thanks
Des

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
Mar | 12 Sep 02:11 2014
Picon

[SBT 0.13.5] A hopefully constructive short story about SBT

Let me start by saying that I quite like SBT, in theory.

In practice, the threshold is steep, or maybe the documentation simply not suffucient to explain or ratify why things work as they do. Anyway, after having sunk 10+ hours into trying to set up a simple project in a manner that to me would seem intuitive, I’m left feeling frustrated and frankly quite stupid.

I will use my project as an example. What I am trying to achieve is the following structure

root-project '- core '- admin-web (Play-project, depends on core) '- user-web (Play-project, depends on core)

I create this structure by issuing

mkdir root-project cd root-project mkdir core activator new admin-web play-scala activator new user-web play-scala

My reason for having this structure is I want the two web-artifacts to be individually deployable. Seems reasonable enough, I think.

Running sbt projects gives the following output

[info] Loading global plugins from /Users/martin/.sbt/0.13/plugins [info] Set current project to root-project (in build file:/Users/martin/dev/scala/root-project/) [info] In file:/Users/martin/dev/scala/root-project/ [info] * root-project

SBT doesn’t look for sub-projects on its own. That’s ok I guess; I need to define the web project’s dependency on core anyhow. Still, I would expect it to consider sub-projects part of the build by default.

I add a build.sbt-definition at root-project/build.sbt:

name := "my project" scalaVersion := "2.11.2" lazy val root = project in file(".") lazy val core = project lazy val `admin-web`, `user-web` = project.dependsOn(core)

And running SBT:

martin <at> mbp ~/dev/scala/root-project]$ sbt [info] Loading global plugins from /Users/martin/.sbt/0.13/plugins /Users/martin/dev/scala/root-project/user-web/build.sbt:5: error: not found: value PlayScala lazy val root = (project in file(".")).enablePlugins(PlayScala) ^ sbt.compiler.EvalException: Type error in expression at [stacktrace of death]

This is totally unintuitive to me. Both Play-projects have their own plugin dependencies declared in their corresponding projects/-directories but for some reason I am forced to pull it out to the root-project level. Why? Shouldn’t it be turtles all the way down?

So I copy the projects-folder up one level from one of the web projects (cp -R admin-web/project .) and add the dependencies to my build.sbt

lazy val `admin-web`, `user-web` = project.dependsOn(core).enablePlugins(PlayScala)

Let’s try it again

[martin <at> mbp ~/dev/scala/root-project]$ sbt projects [info] Loading global plugins from /Users/martin/.sbt/0.13/plugins [info] Loading project definition from /Users/martin/dev/scala/root-project/project [info] Set current project to my project (in build file:/Users/martin/dev/scala/root-project/) [info] In file:/Users/martin/dev/scala/root-project/ [info] admin-web [info] core [info] * root [info] user-web

Looks good! Let’s try running one of the projects

[martin <at> mbp ~/dev/scala/root-project]$ sbt 'admin-web/run' [info] Loading global plugins from /Users/martin/.sbt/0.13/plugins [info] Loading project definition from /Users/martin/dev/scala/root-project/project [info] Set current project to my project (in build file:/Users/martin/dev/scala/root-project/) [info] Updating {file:/Users/martin/dev/scala/root-project/}admin-web... [info] Resolving core#core_2.11;0.1-SNAPSHOT ... [warn] module not found: core#core_2.11;0.1-SNAPSHOT [warn] ==== local: tried [warn] /Users/martin/.ivy2/local/core/core_2.11/0.1-SNAPSHOT/ivys/ivy.xml [warn] ==== public: tried [warn] http://repo1.maven.org/maven2/core/core_2.11/0.1-SNAPSHOT/core_2.11-0.1-SNAPSHOT.pom [warn] ==== Typesafe Releases Repository: tried [warn] http://repo.typesafe.com/typesafe/releases/core/core_2.11/0.1-SNAPSHOT/core_2.11-0.1-SNAPSHOT.pom [info] Resolving jline#jline;2.11 ... [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: core#core_2.11;0.1-SNAPSHOT: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: sbt.ResolveException: unresolved dependency: core#core_2.11;0.1-SNAPSHOT: not found

Say what? Ok, so the core-directory is empty but the declaration is right there in my build.sbt. Why is SBT looking for this artifact on Maven and Ivy?

To get the ball rolling I decide to remove the dependency on the core-project for now, then

[martin <at> mbp ~/dev/scala/root-project]$ sbt 'admin-web/run' [info] Loading global plugins from /Users/martin/.sbt/0.13/plugins [info] Loading project definition from /Users/martin/dev/scala/root-project/project [info] Set current project to my project (in build file:/Users/martin/dev/scala/root-project/) [info] Updating {file:/Users/martin/dev/scala/root-project/}admin-web... [info] Resolving jline#jline;2.11 ... [info] Done updating. --- (Running the application from SBT, auto-reloading is enabled) --- [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000 (Server started, use Ctrl+D to stop and go back to the console...)

Looks good! A quick curl to make sure it’s up and running..

> curl localhost:9000 [error] application - ! Internal server error, for (GET) [/] -> java.util.NoSuchElementException: None.get at scala.None$.get(Option.scala:313) ~[scala-library-2.11.1.jar:na] at scala.None$.get(Option.scala:311) ~[scala-library-2.11.1.jar:na] at play.PlayReloader$$anon$1.reload(PlayReloader.scala:88) ~[na:na] at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:122) ~[play_2.11-2.3.4.jar:2.3.4] at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:120) ~[play_2.11-2.3.4.jar:2.3.4] [warn] play - No application found at invoker init

In all fairness this is probably a Play oddity… but why does it have to be so complicated?


Now, I’ve thought about this post for a couple of days. I’m sorry if it’s written in an unpalatable manner but I’m not quite sure how to present the issue in a friendly manner while conveying my frustration and experience of new beginner’s intuition-failing-repeatedly.

I have delved deeper than this into SBT (and Play Framework) trying to get everything set up like I want, but it seems I’m always touching on a corner-case or plain oddity. Maybe I’m just not cut out to set up build definitions..

Finally, I have a list of a few humble questions/suggestions that may be totally outrageous according to the grander scheme of things SBT. If they are I would be happy to have someone explain why they are. I have been googling for weeks trying to figure this stuff out.

  • It is stated that SBT is recursive in nature. This seems like a sane thing;
  • Based on previous bullet point, it would seem intuitive that sub-projects should be automatically collected by their parent-project without having to spell it out using lazy val declarations; inter-project dependencies would be specified using paths of project rather than name ((project in file("a")) dependsOn (project in file("b")) (but it should maybe be called path rather than file);
  • The previous bullet point basically removes the distinction between a root-project and a sub-project; a project with no parent is a root-project;
  • This also means that with the hierarchy Foo > Bar > Baz, compiling Foo will compile Foo, Bar and Baz, while compiling Bar would compile Bar + Baz;
  • As sub-projects have no knowledge of their parent project[s], they should pull plugins from their own project/-folder (really!);
  • Sub-projects should inherit their parent project’s settings where sane, like scalaVersion/organization/scalac-/javacOptions, removing the need to specify every other key as in ThisBuild (maybe these should indeed be considered build settings and be separated from the project settings?)
  • ThisBuild seems superfluous anyway since settings can still be overridden by sub-projects. If defined in a sub-project, the setting should overrule/extend the parent’s setting just like you'd expect.
  • It would seem intuitive to stow all things build-related into a local .sbt-directory, much like git stores its references. This would get them out of the way of the actual code while still keeping them around.

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
Raymond Barlow | 10 Sep 15:28 2014
Picon

Dependency resolution on newly published artefacts

Hi everyone,

I quite often publish new versions of libraries, to maven central, sonatype, etc.. and then go to use it in another app.

For the 1st haf hour, after I have published the artefact, SBT seems to not be able to resolve it. As an example, today I published version 1.0.88 of Clairvoyance. Once the build had finished and it had been published, I tried to use it from another app. using sbt update, I get output like this for the first half-hour or so.

$ sbt update
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[info] Loading global plugins from /Users/me/.sbt/0.13/plugins
[info] Loading project definition from /Users/me/dev/projects/boost/project
[info] Set current project to boost (in build file:/Users/me/dev/projects/boost/)
[info] Updating {file:/Users/me/dev/projects/boost/}root...
[info] Resolving com.github.rhyskeepence#clairvoyance-scalatest_2.10;1.0.88 ...
[warn] module not found: com.github.rhyskeepence#clairvoyance-scalatest_2.10;1.0.88
[warn] ==== local: tried
[warn] /Users/me/.ivy2/local/com.github.rhyskeepence/clairvoyance-scalatest_2.10/1.0.88/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/github/rhyskeepence/clairvoyance-scalatest_2.10/1.0.88/clairvoyance-scalatest_2.10-1.0.88.pom
[warn] ==== releases: tried
[warn] http://oss.sonatype.org/content/repositories/releases/com/github/rhyskeepence/clairvoyance-scalatest_2.10/1.0.88/clairvoyance-scalatest_2.10-1.0.88.pom
[warn] ==== Typesafe Releases: tried
[warn] http://repo.typesafe.com/typesafe/maven-releases/com/github/rhyskeepence/clairvoyance-scalatest_2.10/1.0.88/clairvoyance-scalatest_2.10-1.0.88.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.rhyskeepence#clairvoyance-scalatest_2.10;1.0.88: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::


Now the weird thing is that, while SBT is telling me this, I can MANUALLY go to
http://oss.sonatype.org/content/repositories/releases/com/github/rhyskeepence/clairvoyance-scalatest_2.10/1.0.88/clairvoyance-scalatest_2.10-1.0.88.pom
and download the pom fine.

Eventually, when it does download (usually about half an hour), it downloads from maven:

[info] downloading https://repo1.maven.org/maven2/com/github/rhyskeepence/clairvoyance-scalatest_2.10/1.0.88/clairvoyance-scalatest_2.10-1.0.88.jar ...
[info] [SUCCESSFUL ] com.github.rhyskeepence#clairvoyance-scalatest_2.10;1.0.88!clairvoyance-scalatest_2.10.jar (915ms)
[info] downloading https://repo1.maven.org/maven2/com/github/rhyskeepence/clairvoyance-core_2.10/1.0.88/clairvoyance-core_2.10-1.0.88.jar ...
[info] [SUCCESSFUL ] com.github.rhyskeepence#clairvoyance-core_2.10;1.0.88!clairvoyance-core_2.10.jar (919ms)


1. Why can't sbt get the files successfully from sonatype when they actually seem to be there?
2. Why does it take so long?

Cheers,
Raymond

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
Caoilte O'Connor | 19 Aug 18:26 2014
Picon

Fwd: [scalatest-users] insufficient context in test failure because of IllegalAnnotationException

Hi,
I get the following JAXB error from sbt when one of my scalatest tests fail

[info] - A Simple class serializes correctly *** FAILED ***
[info]   com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
[info]   at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)

which is insufficient to understand the nature of the problem. I get much more detail in IntelliJ when I run the test there

1 counts of IllegalAnnotationExceptions
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
If a class has <at> XmlElement property, it cannot have <at> XmlValue property.
this problem is related to the following location:
at private final java.lang.String org.caoilte.model.Text.content3
at org.caoilte.atomizer.model.Text
this problem is related to the following location:
at private final java.lang.String org.caoilte.model.Text.text2
at org.caoilte.model.Text

at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)

Could there be an SBT deficiency preventing the entire stack from being printed? (I've already posted to the scalatest mailing list but it occurred to me that it works fine for scalatest in intellij - so it's more likely to be sbt)

c

--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalatest-users <at> googlegroups.com
To unsubscribe from this group, send email to
scalatest-users+unsubscribe <at> googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.
Luchesar Cekov | 18 Aug 12:38 2014
Picon

bintray-sbt cannot publish

I am trying to publish my project to bintray following the instruction to the letter from: https://github.com/softprops/bintray-sbt/blob/0.1.2/README.md


I keep getting:
java.lang.RuntimeException: was not able to find or create a package for luchesar in repo maven named sbt.SettingKey$$anon$4 <at> 6028e736
at scala.sys.package$.error(package.scala:27)
at bintray.Plugin$$anonfun$ensurePackageTask$1.apply(Plugin.scala:72)
at bintray.Plugin$$anonfun$ensurePackageTask$1.apply(Plugin.scala:45)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)

 Sounds really confusing to me and looks like nobody else has experience anything like that... Any suggestions?

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-tool+unsubscribe <at> googlegroups.com.
To post to this group, send email to simple-build-tool <at> googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.

Gmane