diff --git a/ivy/Ivy.scala b/ivy/Ivy.scala index 01b190ff3..76f88b1d2 100644 --- a/ivy/Ivy.scala +++ b/ivy/Ivy.scala @@ -58,7 +58,7 @@ final class IvySbt(configuration: IvyConfiguration) case e: ExternalIvyConfiguration => is.load(e.file) case i: InlineIvyConfiguration => IvySbt.configureCache(is, i.paths.cacheDirectory) - IvySbt.setResolvers(is, i.resolvers, log) + IvySbt.setResolvers(is, i.resolvers, i.otherResolvers, log) IvySbt.setModuleConfigurations(is, i.moduleConfigurations) } is @@ -167,17 +167,26 @@ private object IvySbt def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename) def defaultPOM(project: File) = new File(project, DefaultMavenFilename) - /** Sets the resolvers for 'settings' to 'resolvers'. This is done by creating a new chain and making it the default. */ - private def setResolvers(settings: IvySettings, resolvers: Seq[Resolver], log: IvyLogger) + /** Sets the resolvers for 'settings' to 'resolvers'. This is done by creating a new chain and making it the default. + * 'other' is for resolvers that should be in a different chain. These are typically used for publishing or other actions. */ + private def setResolvers(settings: IvySettings, resolvers: Seq[Resolver], other: Seq[Resolver], log: IvyLogger) { - val newDefault = new ChainResolver - newDefault.setName("sbt-chain") - newDefault.setReturnFirst(true) - newDefault.setCheckmodified(true) - resolvers.foreach(r => newDefault.add(ConvertResolver(r))) + val otherChain = resolverChain("sbt-other", other) + settings.addResolver(otherChain) + val newDefault = resolverChain("sbt-chain", resolvers) settings.addResolver(newDefault) settings.setDefaultResolver(newDefault.getName) log.debug("Using repositories:\n" + resolvers.mkString("\n\t")) + log.debug("Using other repositories:\n" + other.mkString("\n\t")) + } + private def resolverChain(name: String, resolvers: Seq[Resolver]): ChainResolver = + { + val newDefault = new ChainResolver + newDefault.setName(name) + newDefault.setReturnFirst(true) + newDefault.setCheckmodified(true) + resolvers.foreach(r => newDefault.add(ConvertResolver(r))) + newDefault } private def setModuleConfigurations(settings: IvySettings, moduleConfigurations: Seq[ModuleConfiguration]) { diff --git a/ivy/IvyCache.scala b/ivy/IvyCache.scala index 98d50da9b..b7c18c0ba 100644 --- a/ivy/IvyCache.scala +++ b/ivy/IvyCache.scala @@ -86,7 +86,7 @@ object IvyCache { val local = Resolver.defaultLocal(None) val paths = new IvyPaths(new File("."), None) - val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, lock, log) + val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, lock, log) (new IvySbt(conf), local) } /** Creates a default jar artifact based on the given ID.*/ diff --git a/ivy/IvyConfigurations.scala b/ivy/IvyConfigurations.scala index a052b9fc2..385eb260d 100644 --- a/ivy/IvyConfigurations.scala +++ b/ivy/IvyConfigurations.scala @@ -18,12 +18,12 @@ sealed trait IvyConfiguration extends NotNull def log: IvyLogger def withBase(newBaseDirectory: File): This } -final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver], +final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver], val otherResolvers: Seq[Resolver], val moduleConfigurations: Seq[ModuleConfiguration], val lock: Option[xsbti.GlobalLock], val log: IvyLogger) extends IvyConfiguration { type This = InlineIvyConfiguration def baseDirectory = paths.baseDirectory - def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, moduleConfigurations, lock, log) + def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, otherResolvers, moduleConfigurations, lock, log) } final class ExternalIvyConfiguration(val baseDirectory: File, val file: File, val lock: Option[xsbti.GlobalLock], val log: IvyLogger) extends IvyConfiguration { @@ -42,7 +42,7 @@ object IvyConfiguration if(defaultIvyConfigFile.canRead) new ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log) else - new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, lock, log) + new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, lock, log) } }