-
Notifications
You must be signed in to change notification settings - Fork 167
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
Use relative path for local libraries #34
Comments
I suggest that the plugin should generate "var" entries instead of "lib" entries with hard-coded paths. An example of such a "lib" entry is: <classpathentry kind="lib" path="/home/myuser/.ivy2/cache/org.scala-tools.sbt/sbt_2.9.1/jars/sbt_2.9.1-0.11.0.jar"/> It would be ideal if the user's home directory was assigned to a USER_HOME Classpath Variable. Then the .classpath can look like the following, allowing the .ivy2 and .sbt directories to be resolved: <?xml version="1.0" encoding="UTF-8"?> This should work correctly under Linux and Windows (in the latter case, USER_HOME would be set to something like C:/Documents and Settings/myuser) |
One reason we want to use lib_managed is that we can check it in to version control. That may be crazy talk but in corporate environments its often the simplest thing to do to enable devs to check out code and start working easily. We don't always have easy/direct access to the internet. |
Will be part of sbteclipse 2.0.0. |
excellent thanks |
Is this still not fixed in 4.0.0?
generates
I would expect a mechanism to replace In fact, I have a crude workaround already, in
import sbt._
import Keys._
import scalaz.Scalaz._
import com.typesafe.sbteclipse.core._
import com.typesafe.sbteclipse.core.EclipsePlugin._
import scala.xml.transform._
object ClasspathentryRewriteRule extends RewriteRule {
import scala.xml._
override def transform(parent: Node): Seq[Node] = {
val ivyHome = System.getProperty("user.home") + "/.ivy2"
parent match {
case c @ <classpathentry/> if (
((c \ "@kind").toString() == "lib")
&& ((c \ "@path").toString() startsWith ivyHome)
&& ((c \ "@sourcepath").toString() startsWith ivyHome)) => {
<classpathentry kind="var" path={ (c \ "@path").toString.replaceAll(ivyHome, "IVY_HOME") }
sourcepath={ (c \ "@sourcepath").toString.replaceAll(ivyHome, "IVY_HOME") } />
}
case c @ <classpathentry/> if (
((c \ "@kind").toString() == "lib")
&& ((c \ "@path").toString() startsWith ivyHome)) => {
<classpathentry kind="var" path={ (c \ "@path").toString.replaceAll(ivyHome, "IVY_HOME") } />
}
case other => other
}
}
}
object ClasspathentryTransformer extends EclipseTransformerFactory[RewriteRule] {
override def createTransformer(ref: ProjectRef, state: State): Validation[RewriteRule] = {
ClasspathentryRewriteRule.success
}
} Thanks |
This seems to work with both keys set: |
When the sbt option retrieveManaged is 'true', then it would be nice for the classpaths set in .classpath to be relative to the project root. This allows the .classpath to be shared by more than one user when devs check out code.
The text was updated successfully, but these errors were encountered: