diff --git a/ivy/src/main/scala/sbt/CustomPomParser.scala b/ivy/src/main/scala/sbt/CustomPomParser.scala index 7bc878b2b..202216700 100644 --- a/ivy/src/main/scala/sbt/CustomPomParser.scala +++ b/ivy/src/main/scala/sbt/CustomPomParser.scala @@ -54,7 +54,8 @@ object CustomPomParser { lazy val registerDefault: Unit = ModuleDescriptorParserRegistry.getInstance.addParser(default) def defaultTransform(parser: ModuleDescriptorParser, md: ModuleDescriptor): ModuleDescriptor = - if (transformedByThisVersion(md)) md else defaultTransformImpl(parser, md) + if (transformedByThisVersion(md)) md + else defaultTransformImpl(parser, md) private[this] def transformedByThisVersion(md: ModuleDescriptor): Boolean = { diff --git a/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala b/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala index 685431124..9a2b483aa 100644 --- a/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala +++ b/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala @@ -7,7 +7,7 @@ import java.util.Date import org.apache.ivy.core.settings.IvySettings import org.apache.ivy.core.{ IvyContext, LogOptions } -import org.apache.ivy.core.module.descriptor.{ ModuleDescriptor, DependencyDescriptor, Artifact => IArtifact } +import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, DefaultModuleDescriptor, DefaultDependencyDescriptor, ModuleDescriptor, DependencyDescriptor } import org.apache.ivy.core.resolve.{ ResolvedModuleRevision, ResolveData } import org.apache.ivy.plugins.latest.LatestStrategy import org.apache.ivy.plugins.repository.file.{ FileRepository => IFileRepository, FileResource } @@ -94,6 +94,23 @@ class SbtChainResolver(name: String, resolvers: Seq[DependencyResolver], setting } else temp map { x => (forcedRevision(x), resolver) } ) + retval match { + case Right(Some((rmr, _))) => + rmr.getDescriptor.getPublicationDate match { + case null => + val ivf = resolver.findIvyFileRef(dd, data) + val lmd = new java.util.Date(ivf.getLastModified) + rmr.getDescriptor match { + case dmd: DefaultModuleDescriptor => + Message.info(s"Getting null publication date from resolver: ${resolver} for ${rmr.getId}, setting to: ${lmd}") + dmd.setPublicationDate(lmd) + case _ => + Message.warn(s"Getting null publication date from resolver: ${resolver} for ${rmr.getId}, resolution order is undefined!") + } + case _ => // All other cases ok + } + case _ => + } retval } catch { case ex: Exception => @@ -111,7 +128,10 @@ class SbtChainResolver(name: String, resolvers: Seq[DependencyResolver], setting val sorted = if (useLatest) (foundRevisions.sortBy { case (rmr, _) => - rmr.getDescriptor.getPublicationDate.getTime + rmr.getDescriptor.getPublicationDate match { + case null => 0L + case d => d.getTime + } }).reverse.headOption map { case (rmr, resolver) => // Now that we know the real latest revision, let's force Ivy to use it diff --git a/main/src/main/scala/sbt/Act.scala b/main/src/main/scala/sbt/Act.scala index 272f7e074..f0aa68dd4 100644 --- a/main/src/main/scala/sbt/Act.scala +++ b/main/src/main/scala/sbt/Act.scala @@ -163,8 +163,8 @@ object Act { } def resolveTask(task: ParsedAxis[AttributeKey[_]]): Option[AttributeKey[_]] = task match { - case ParsedGlobal | Omitted => None - case t: ParsedValue[AttributeKey[_]]@unchecked => Some(t.value) + case ParsedGlobal | Omitted => None + case t: ParsedValue[AttributeKey[_]] @unchecked => Some(t.value) } def filterStrings(base: Parser[String], valid: Set[String], label: String): Parser[String] = diff --git a/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/build.sbt b/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/build.sbt index d2fda41f7..1b7c85bf5 100644 --- a/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/build.sbt +++ b/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/build.sbt @@ -6,10 +6,12 @@ lazy val localRemote = lazy val common = project .settings( - name := "published-maven", - organization := "com.example", - version := "1.0.0-SNAPSHOT", - publishTo := Some(localRemote) + name := "config", + organization := "com.typesafe", + version := "0.4.9-SNAPSHOT", + publishTo := Some(localRemote), + autoScalaLibrary := false, + crossPaths := false ) lazy val analyze = @@ -20,6 +22,7 @@ lazy val analyze = organization := "com.example", version := "1.0.0-SNAPSHOT", resolvers += localRemote, + resolvers += Resolver.sonatypeRepo("snapshots"), fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project") ) diff --git a/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/test b/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/test index 152da2cfd..46f62f6f7 100644 --- a/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/test +++ b/sbt/src/sbt-test/dependency-management/publish-to-maven-local-file/test @@ -1,2 +1,3 @@ > common/publishM2 -> analyze/update +> common/publish +> analyze/update \ No newline at end of file