Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with lib #11

Closed
mgenereu opened this issue Dec 3, 2014 · 7 comments
Closed

Trouble with lib #11

mgenereu opened this issue Dec 3, 2014 · 7 comments

Comments

@mgenereu
Copy link

mgenereu commented Dec 3, 2014

The .classpath_nb uses relative paths for the lib folder. This means I have to run '/usr/local/netbeans-8.0.2/bin/netbeans' from the terminal in that folder instead of clicking the icon in Unity. Could the lib references be absolute?

@dcaoyuan
Copy link
Owner

dcaoyuan commented Dec 3, 2014

Would you please give me the piece of .classpath_nb which you mentioned? since I have no problem under Fedora, where I run NetBeans via short_cut

@mgenereu
Copy link
Author

mgenereu commented Dec 4, 2014

Here's a line relatively referencing a file from my lib. Actual path /home/mgenereux/Projects/test/lib.

<classpathentry kind="lib" path="./lib/lang-scala_2.10-1.1.0-SNAPSHOT.jar" scope="compile"/>

Thanks!

@dcaoyuan
Copy link
Owner

dcaoyuan commented Dec 6, 2014

It seems your project depends on the lib jar directly instead of ivy? How did you define the lib dependency in your Build.scala or build.sbt?

@mgenereu
Copy link
Author

mgenereu commented Dec 6, 2014

Neither. SBT includes the lib folder per http://www.scala-sbt.org/0.13/tutorial/Library-Dependencies.html .

@mgenereu
Copy link
Author

mgenereu commented Dec 9, 2014

I'm still learning Scala or I'd try to make a pull request. Could you point me in the right direction so I could help?

@dcaoyuan
Copy link
Owner

I took a look at the corresponding code in nbscala:

            case "lib" =>
              val path = (entry \ "@path").text.trim.replace("\\", "/")
              val isTest = (entry \ "@scope").text.trim.equalsIgnoreCase("test")
              val libFile = new File(path) match {
                case x if x.isAbsolute => x
                case _                 => new File(projectDir, path)
              }

              if (libFile.exists) {
                if (isTest) {
                  testCps += libFile
                } else {
                  mainCps += libFile
                }
              }

It seems the relative lib path should have been converted to absolute path with projectDir as parent.
For more information, please see:

https://github.com/dcaoyuan/nbscala/blob/master/scala.sbt/src/main/scala/org/netbeans/modules/scala/sbt/project/SBTResolver.scala

@mgenereu
Copy link
Author

Ah. So the .classpath_nb is correct to specify relative and then the plugin should respect that in turn. I'll create a pull request on the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants