mirror of https://github.com/sbt/sbt.git
commit
8554d11d3d
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import java.io.File
|
||||
import java.io.{ IOException, File }
|
||||
import java.net.URL
|
||||
import scala.xml.{ Text, NodeSeq, Elem, XML }
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver
|
||||
|
|
@ -304,14 +304,17 @@ object Resolver {
|
|||
private[this] def mavenLocalDir: File = {
|
||||
def loadHomeFromSettings(f: () => File): Option[File] =
|
||||
try {
|
||||
val file = XML.loadFile(f())
|
||||
(file \ "localRepository").text match {
|
||||
val file = f()
|
||||
if(!file.exists) None
|
||||
else ((XML.loadFile(file) \ "localRepository").text match {
|
||||
case "" => None
|
||||
case e @ _ => Some(new File(e))
|
||||
}
|
||||
})
|
||||
} catch {
|
||||
// Occurs inside File constructor when property or environment variable does not exist
|
||||
case _: NullPointerException => None
|
||||
// Occurs when File does not exist
|
||||
case _: IOException => None
|
||||
case e: SAXParseException => System.err.println(s"WARNING: Problem parsing ${f().getAbsolutePath}, ${e.getMessage}"); None
|
||||
}
|
||||
loadHomeFromSettings(() => new File(Path.userHome, ".m2/settings.xml")) orElse
|
||||
|
|
|
|||
Loading…
Reference in New Issue