Hi,

I am new to Akka and Scala. I was trying out the HelloAkka.java program in 
eclipse.

The program is here 
https://github.com/typesafehub/activator-hello-akka-java8/blob/master/src/main/java/HelloAkka.java

Around the line 60 and 66, where we call Duration.create(), I get 
compilation error in gradle. Below is the compilation error

:compileJava

/Users/neerajsingh/hello-akka-java8/src/main/java/HelloAkka.java:61: error: 
unreported exception TimeoutException; must be caught or declared to be 
thrown

        Greeting greeting1 = (Greeting) inbox.receive(Duration.create(5, 
TimeUnit.SECONDS));

                                                     ^

/Users/neerajsingh/hello-akka-java8/src/main/java/HelloAkka.java:67: error: 
unreported exception TimeoutException; must be caught or declared to be 
thrown

        Greeting greeting2 = (Greeting) inbox.receive(Duration.create(5, 
TimeUnit.SECONDS));

                                                     ^

2 errors

:compileJava FAILED



Now, the same program works fine in my eclipse and activator. So, wondering 
what I am doing wrong in gradle build script


Meanwhile, when I handle the TimeoutException, gradle compile works fine. 
But wondering why this error, when the documentation doesn;t mention any 
such exceptions 
http://www.scala-lang.org/api/2.9.3/scala/concurrent/duration/Duration$.html

Here is my build script, which has been copied from the Hakka documentation 
http://doc.akka.io/docs/akka/snapshot/intro/getting-started.html

Using Akka with Gradle

Requires at least Gradle <https://gradle.org/> 1.4 Uses the Scala plugin 
<http://www.gradle.org/docs/current/userguide/scala_plugin.html>


   1. apply plugin: 'scala'
   2.  
   3. repositories {
   4.   mavenCentral()
   5. }
   6.  
   7. dependencies {
   8.   compile 'org.scala-lang:scala-library:2.11.8'
   9. }
   10.  
   11. tasks.withType(ScalaCompile) {
   12.   scalaCompileOptions.useAnt = false
   13. }
   14.  
   15. dependencies {
   16.   compile group: 'com.typesafe.akka', name: 'akka-actor_2.11', version: 
'2.4-SNAPSHOT'
   17.   compile group: 'org.scala-lang', name: 'scala-library', version: 
'2.11.8'
   18. }


-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to