Doesn't compile when adding dependencies onto GitHub project

Hi, I just started using IntelliJ and GitHub for Scala projects.

What I'm trying to do with them is:

  • have some work-in-progress SBT projects on GitHub
  • make some of them refer to another or each others


I'm using IntelliJ(CE, 13.1.3) and the Scala plugin(0.38.437).
To refer to a GitHub repo from an SBT project I'm totally following Alvin's blog.

The problem happening on IntelliJ with the methods above is:

  • the editor is working well; the referred library's items are perfectly seen.
  • the compiler isn't; all "import" to the referred library are "not found".


The actual project is here. Please compile with your IntelliJ and tell me what happened.
Also about any better ways to refer GitHub repo's from SBT projects, please let me know!
Thank you in advance :)

0
8 comments

When scalaVersion is not defined, then it will be picked by sbt-launcher version. In IDEA we are using bundled sbt-launcher with scalaVersion = 2.10.3. So problem of compilation is that 2.10.3 can't compile project with scala-library of version 2.11.1 and it's absolutely normal.

Add scalaVersion := "2.11.1" to both your repositories and compilation will work.

Best regards,
Alexander Podkhalyuzin.

0

Hi Alex, thank you for replying.
It seems the Scala version specification wasn't the cause of this error.

This is what I did following your advice:

  1. edited both
    build.sbt
    adding
    scalaVersion := "2.11.1"
  2. added/committed the change and pushed both projects on GitHub repo's
  3. deleted
    ~\.IdeaIC13\system\SBT\staging
    for the Git issue
  4. ran IntelliJ; the modified GitHub repo was cloned into the staging dir
  5. compiled the project; the error happened again.


So I still have the same problem, waiting for some more help!

0

Right now problem is that project contains some amount of real compiler errors (which were not highlighted in IntelliJ IDEA, because not everything is still implemented in our error highlighting).
For exmaple:
implicit val DataI = new DataFormat[DataInput] {
 import InputStreamOp._
 import OutputStreamOp._
 def reads(s: DataInput) = s.i.copy
 def writes(s: DataOutput, i: DataInput) = s.o.write(i.i)
 }

here InputStreamOp imports C implicit conversion and OutputStreamOp also imports C implicit conversion. So because of name ambiguity compiler can't use any of this implicit conversions. Rename second into F and dataio will be compilable.
Second module contains other errors with accesibility.

Best regards,
Alexander Podkhalyuzin.

0

I'm so sorry, now it should be ready for you!
I had totally forgot to work on a branch. :p

And, just so you know,

Second module contains other errors with accesibility.

is what we are talking about in this topic.

Thank you!

0

I've figured out why it happened: the referred module(s) has to be manually compiled before the main module. I was assuming it shoud've been automatically done, because the native SBT (version 0.13.5) actually does it by

sbt compile
on the reffering project's dir. Is there the exact alternative thing in IntelliJ?
Thank you!
0

I still have compilation errors in both IDEA and SBT command line. So I still can't understand what the problem was, but I'm glad it's solved now.

If some module depends on other, then you don't need manually compile first module. It should work in IntelliJ IDEA as well.

Best regards,
Alexander Podkhalyuzin.

0

Using the lastest IntelliJ (13.4) might solved it. And in fact, even the lastest one, doesn't compile the referred modules when I tell it to compile the root one. So.. I don't know what's going on. How do you compile the project? I always right-click the root module in the Project explorer and click "Compile Module <name of the module>", and it doesn't compile referred modules. Thank you!

0

Build -> Make Project (Ctrl+F9 for Windows, Cmd+F9 for Mac). If you want to compile single Module without other modules recompilation you can compile Module as you usually do, but then it will compile only this single module and it's ok, becuase you probably don't want to recompile depending modules.

Best regards,
Alexander Podkhlayuzin.

0

Please sign in to leave a comment.