problems with adding dependencies to play plugins.sbt file

520 views
Skip to first unread message

Michal Singer

unread,
Dec 3, 2015, 3:09:03 AM12/3/15
to play-framework
Hi, i just started using play framework and scala.
I ran scala as a stand alone - and added dependencies to the build.sbt file and they work fine.
Then, i tried raising play and added the same dependencies to the plugins.sbt file which as i understood was were new dependencies should be added.
I got these errors:
[warn] Note: Unresolved dependencies path:
[warn] org.apache.kafka:kafka-clients:0.8.2.1 (scalaVersion=2.10, sbtVersion=0.13) (D:\Dev\workspace_scala\play-scala\project\plugins.sbt#L22-23)
[warn]  +- default:play-scala-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13)
[warn] org.apache.kafka:kafka_2.10:0.8.2.1 (scalaVersion=2.10, sbtVersion=0.13) (D:\Dev\workspace_scala\play-scala\project\plugins.sbt#L23-24)
[warn]  +- default:play-scala-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: org.apache.kafka#kafka-clients;0.8.2.1: not found
unresolved dependency: org.apache.kafka#kafka_2.10;0.8.2.1: not found

I am using version of play: 2.4.4 and scala version: 2.11.5


This is what i added to plugins.sbt which did not work
addSbtPlugin("net.databinder.dispatch" %% "dispatch-core" % "0.11.2")
addSbtPlugin("log4j" % "log4j" % "1.2.17")
addSbtPlugin("org.apache.kafka" % "kafka-clients" % "0.8.2.1")
addSbtPlugin("org.apache.kafka" % "kafka_2.10" % "0.8.2.1")

and this is what i added to build.sbt on a different project (with out play) which worked fine:

libraryDependencies ++= Seq("org.apache.kafka" % "kafka-clients" % "0.8.2.1",
"org.apache.kafka" % "kafka_2.10" % "0.8.2.1",
"log4j" % "log4j" % "1.2.17",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2")


I could not solve this issue.
any ideas how to solve this?

thanks

Igmar Palsenberg

unread,
Dec 3, 2015, 3:16:41 AM12/3/15
to play-framework
 
I am using version of play: 2.4.4 and scala version: 2.11.5


This is what i added to plugins.sbt which did not work
addSbtPlugin("net.databinder.dispatch" %% "dispatch-core" % "0.11.2")
addSbtPlugin("log4j" % "log4j" % "1.2.17")
addSbtPlugin("org.apache.kafka" % "kafka-clients" % "0.8.2.1")
addSbtPlugin("org.apache.kafka" % "kafka_2.10" % "0.8.2.1")

and this is what i added to build.sbt on a different project (with out play) which worked fine:

libraryDependencies ++= Seq("org.apache.kafka" % "kafka-clients" % "0.8.2.1",
"org.apache.kafka" % "kafka_2.10" % "0.8.2.1",
"log4j" % "log4j" % "1.2.17",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2")

The addSbtPlugin is wrong : It's not an SBT plugin. The latter one (libraryDependencies ++= ) should work fine, we also use that. What's the issue you're having with that ?



Igmar 

Michal Singer

unread,
Dec 3, 2015, 3:57:42 AM12/3/15
to play-framework
Hi, the problem is when i use play framework, i run the application using: "activator run" and it uses the plugins.sbt and not the build.sbt.
In the plugins.sbt the format i saw is the addSbtPlugin, can i use the libraryDependencies also in the plugins.sbt when using play?

Igmar Palsenberg

unread,
Dec 3, 2015, 5:17:54 AM12/3/15
to play-framework


Op donderdag 3 december 2015 09:57:42 UTC+1 schreef Michal Singer:
Hi, the problem is when i use play framework, i run the application using: "activator run" and it uses the plugins.sbt and not the build.sbt.
In the plugins.sbt the format i saw is the addSbtPlugin, can i use the libraryDependencies also in the plugins.sbt when using play?

That really isn't the case. At least, it shouldn't be. I have everything in plugins.sbt, and just one 

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")

in project/plugins.sbt.


Igmar

Michal Singer

unread,
Dec 3, 2015, 6:56:39 AM12/3/15
to play-fr...@googlegroups.com
you mean under build.sbt? since there is only one plugins.sbt and one build.sbt

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/CvdsfZPdKCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/e4f184ef-c75c-4747-912a-fa54d7dee7b0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Igmar Palsenberg

unread,
Dec 3, 2015, 7:18:57 AM12/3/15
to play-framework


Op donderdag 3 december 2015 12:56:39 UTC+1 schreef Michal Singer:
you mean under build.sbt? since there is only one plugins.sbt and one build.sbt

build.sbt indeed.


Igmar

Michal Singer

unread,
Dec 3, 2015, 7:41:59 AM12/3/15
to play-fr...@googlegroups.com
Ok. thanks, i guess my problem was not that. i tried to add a kafka to the sbt but it did not work when i added it to the build.sbt of play environment.
But when i added it to a regular scala project build.sbt file it works. i have no idea why (this is why i tried adding this to the plugins.sbt - which i thought might solve the problem but ended as a wrong move)

This is what i am trying to add:

libraryDependencies ++= Seq(
.... (ignore these lines !!)
"org.apache.kafka" % "kafka_2.10" % "0.9.0.0",
"org.apache.kafka" % "kafka-clients" % "0.9.0.0"
)
Any idea why this does not find the kafka libs?
thanks



Igmar

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/CvdsfZPdKCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

Igmar Palsenberg

unread,
Dec 3, 2015, 7:53:19 AM12/3/15
to play-framework


Op donderdag 3 december 2015 13:41:59 UTC+1 schreef Michal Singer:
Ok. thanks, i guess my problem was not that. i tried to add a kafka to the sbt but it did not work when i added it to the build.sbt of play environment.
But when i added it to a regular scala project build.sbt file it works. i have no idea why (this is why i tried adding this to the plugins.sbt - which i thought might solve the problem but ended as a wrong move)

This is what i am trying to add:

libraryDependencies ++= Seq(
.... (ignore these lines !!)
"org.apache.kafka" % "kafka_2.10" % "0.9.0.0",
"org.apache.kafka" % "kafka-clients" % "0.9.0.0"
)
Any idea why this does not find the kafka libs?

What's the error you're getting ? It works fine here. You probably want kafka_2.11 here, since recent play version use that Scala version. In my experience, mixing 2.10 and 2.11 doesn't work.


Igmar 

Michal Singer

unread,
Dec 3, 2015, 8:24:24 AM12/3/15
to play-fr...@googlegroups.com
I added this now to your suggestion:

libraryDependencies ++= Seq(

"org.apache.kafka" % "kafka_2.11" % "0.9.0.0"
)
and i am still getting an error on the producer on this line of code:
val producer = new Producer[AnyRef, AnyRef](new ProducerConfig(props))
play.sbt.PlayExceptions$CompilationException: Compilation error[not found: type Producer]




Igmar 

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/CvdsfZPdKCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

Michal Singer

unread,
Dec 3, 2015, 8:32:11 AM12/3/15
to play-fr...@googlegroups.com
Ok, i found the problem, the example i used had missing imports. 
Thanks for all your assistance.

Igmar Palsenberg

unread,
Dec 3, 2015, 8:35:14 AM12/3/15
to play-framework


Op donderdag 3 december 2015 14:24:24 UTC+1 schreef Michal Singer:
I added this now to your suggestion:

libraryDependencies ++= Seq(

"org.apache.kafka" % "kafka_2.11" % "0.9.0.0"
)
and i am still getting an error on the producer on this line of code:
val producer = new Producer[AnyRef, AnyRef](new ProducerConfig(props))
play.sbt.PlayExceptions$CompilationException: Compilation error[not found: type Producer]

Try an activator update. It works fine here, also with Scala code.
Do you have proper imports ? Should be like 

import kafka.producer.{ProducerConfig, Producer}

Igmar 

Michal Singer

unread,
Dec 3, 2015, 8:51:21 AM12/3/15
to play-fr...@googlegroups.com
Yes, my problem was imports. I wrote it - i guess you didn't get that.
I took an example from online which missed some imports and i guess i got confused with the scala and all and looked for some bugger issue instead (newbie in scala).

Any ways, what do you mean by activator update?

thanks a lot for all the help :-)



Igmar 

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/CvdsfZPdKCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

Igmar Palsenberg

unread,
Dec 3, 2015, 9:03:12 AM12/3/15
to play-framework


Op donderdag 3 december 2015 14:51:21 UTC+1 schreef Michal Singer:
Yes, my problem was imports. I wrote it - i guess you didn't get that.
I took an example from online which missed some imports and i guess i got confused with the scala and all and looked for some bugger issue instead (newbie in scala).

activator update forces sbt to re-do dependencies. About the import : A decent IDE will help you with that. I use IntelliJ, that has good Scala support.


Igmar 

Michal Singer

unread,
Dec 6, 2015, 12:00:17 AM12/6/15
to play-fr...@googlegroups.com
hi, i am using intelij but on the project i raised for play for some reason the dependencies i added to build.sbt are not refelceted in the intelij and the imports are red like not detected even though the project compiles the fine.
this is what caused the confusion.
thansk

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/CvdsfZPdKCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

Michal Singer

unread,
Dec 6, 2015, 12:11:07 AM12/6/15
to play-framework


On Sunday, December 6, 2015 at 7:00:17 AM UTC+2, Michal Singer wrote:hi, i am using intelij but on the project i raised for play for some reason the dependencies i added to build.sbt were not refelceted in the intelij and the imports were red like not detected even though the project compiles the fine.
But I fixed it now, but still the routes file still has red lines like the classes of actions are not found, even though they are.
any ideas why that might happen? 

Thanks

On Thu, Dec 3, 2015 at 4:03 PM, Igmar Palsenberg <ig...@palsenberg.com> wrote:


Op donderdag 3 december 2015 14:51:21 UTC+1 schreef Michal Singer:
Yes, my problem was imports. I wrote it - i guess you didn't get that.
I took an example from online which missed some imports and i guess i got confused with the scala and all and looked for some bugger issue instead (newbie in scala).

activator update forces sbt to re-do dependencies. About the import : A decent IDE will help you with that. I use IntelliJ, that has good Scala support.


Igmar 

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/CvdsfZPdKCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framework+unsubscribe@googlegroups.com.

Igmar Palsenberg

unread,
Dec 8, 2015, 5:25:14 AM12/8/15
to play-framework
 
hi, i am using intelij but on the project i raised for play for some reason the dependencies i added to build.sbt are not refelceted in the intelij and the imports are red like not detected even though the project compiles the fine.
this is what caused the confusion.

Usually, an activactor update / touch build.sbt fixes this. I have this especially if I modify build.sbt outside of IntelliJ (which I do all the time).



Igmar 
Reply all
Reply to author
Forward
0 new messages