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

updateClassifiers doesn't download sources and docs for updated snapshot dependencies #1750

Closed
newffy opened this issue Nov 26, 2014 · 20 comments
Labels
area/library_management library management
Milestone

Comments

@newffy
Copy link

newffy commented Nov 26, 2014

Hello.
sbt.version=0.13.7
we are using corporate maven repository (served by artifactory 3.4.1)
Our libraryDependencies:

libraryDependencies ++= {
    val jettyVer = "9.2.3.v20140905"
    val akkaVersion = "2.3.7"
    val kamonVersion = "0.3.5"
    Seq(
        "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
        "com.simplesys" %% "akka-extender" % "1.0.2-SNAPSHOT",
        "com.simplesys" %% "isc-wrapper" % "1.0.0-SNAPSHOT",
        "com.simplesys" %% "common" % "1.0.0-SNAPSHOT",
        "com.simplesys.jdbc.drivers" % "oracle" % "11.2.0.4",
        "com.simplesys" %% "isc-components" % "1.0.0-SNAPSHOT",
        "com.simplesys" %% "core-library" % "1.0.0-SNAPSHOT",
        "com.simplesys" %% "scala-io-extender" % "1.0.0-SNAPSHOT",
        "ru.simplesys" %% "core-domains" % "1.2.1-SNAPSHOT",
        "ru.simplesys" %% "core-utils" % "1.0.1-SNAPSHOT",
        "com.simplesys" % "smartclient-js" % "10.0-v20141114",
        "com.simplesys" %% "scala-gen" % "1.0.0-SNAPSHOT" % "test",
        "com.typesafe.akka" %% "akka-actor" % akkaVersion,
        "com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
        "com.typesafe.akka" %% "akka-persistence-experimental" % akkaVersion exclude("org.iq80.leveldb","leveldb"),
        "org.iq80.leveldb" % "leveldb" % "0.7",
        "com.twitter" %% "chill-akka" % "0.5.0",
        "com.github.bseibel" %% "akka-persistence-bdb" % "1.0.1",
        "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
        "org.eclipse.jetty" % "jetty-webapp" % jettyVer % "container",
        "org.eclipse.jetty" % "jetty-annotations" % jettyVer % "container",
        "org.eclipse.jetty" % "jetty-plus" % jettyVer % "container",
        "org.scalatest" %% "scalatest" % "2.2.2" % "test",
        "org.scalaj" %% "scalaj-http" % "0.3.16" % "test",
        "org.json4s" %% "json4s-jackson" % "3.2.10" % "test",
        "org.scalaz" %% "scalaz-core" % "7.1.0",
        "com.simplesys.edu.mit" % "jwi" % "2.3.3",
        "org.parboiled" %% "parboiled" % "2.0.1",
        "io.kamon" %% "kamon-core" % kamonVersion,
        "io.kamon" %% "kamon-statsd" % kamonVersion,
        "io.kamon" %% "kamon-system-metrics" % kamonVersion)

during updateClassifiers only jars are downloaded, without sources and docs, although they all have published sources and docs. This is really annoying, I'm ready to supply all info you need.
We are using

addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.13")

for publishing

updateClassifiers log:

sbt (dm-processing)> updateClassifiers
[info] Resolving org.ow2.asm#asm-tree;5.0.1 ...
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/akka-extender_2.11/1.0.2-SNAPSHOT/akka-extender_2.11-1.0.2-20141125.141707-139.jar ...
[info]  [SUCCESSFUL ] com.simplesys#akka-extender_2.11;1.0.2-SNAPSHOT!akka-extender_2.11.jar (1006ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/servlet-wrapper_2.11/1.0.0-SNAPSHOT/servlet-wrapper_2.11-1.0.0-20141125.141655-84.jar ...
[info]  [SUCCESSFUL ] com.simplesys#servlet-wrapper_2.11;1.0.0-SNAPSHOT!servlet-wrapper_2.11.jar (1120ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/xml-extender_2.11/1.0.0-SNAPSHOT/xml-extender_2.11-1.0.0-20141125.141653-18.jar ...
[info]  [SUCCESSFUL ] com.simplesys#xml-extender_2.11;1.0.0-SNAPSHOT!xml-extender_2.11.jar (743ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/logback-wrapper_2.11/1.0.0-SNAPSHOT/logback-wrapper_2.11-1.0.0-20141125.141653-20.jar ...
[info]  [SUCCESSFUL ] com.simplesys#logback-wrapper_2.11;1.0.0-SNAPSHOT!logback-wrapper_2.11.jar (785ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/common_2.11/1.0.0-SNAPSHOT/common_2.11-1.0.0-20141125.141653-33.jar ...
[info]  [SUCCESSFUL ] com.simplesys#common_2.11;1.0.0-SNAPSHOT!common_2.11.jar (895ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/joda-wrapper_2.11/1.0.0-SNAPSHOT/joda-wrapper_2.11-1.0.0-20141125.141653-20.jar ...
[info]  [SUCCESSFUL ] com.simplesys#joda-wrapper_2.11;1.0.0-SNAPSHOT!joda-wrapper_2.11.jar (760ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/saxon-wrapper_2.11/1.0.0-SNAPSHOT/saxon-wrapper_2.11-1.0.0-20141125.141653-18.jar ...
[info]  [SUCCESSFUL ] com.simplesys#saxon-wrapper_2.11;1.0.0-SNAPSHOT!saxon-wrapper_2.11.jar (718ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/scala-io-extender_2.11/1.0.0-SNAPSHOT/scala-io-extender_2.11-1.0.0-20141125.141653-19.jar ...
[info]  [SUCCESSFUL ] com.simplesys#scala-io-extender_2.11;1.0.0-SNAPSHOT!scala-io-extender_2.11.jar (707ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/ru/simplesys/core-utils_2.11/1.0.1-SNAPSHOT/core-utils_2.11-1.0.1-20141125.140620-6.jar ...
[info]  [SUCCESSFUL ] ru.simplesys#core-utils_2.11;1.0.1-SNAPSHOT!core-utils_2.11.jar (663ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/json-extender-typesafe_2.11/1.0.0-SNAPSHOT/json-extender-typesafe_2.11-1.0.0-20141125.141655-28.jar ...
[info]  [SUCCESSFUL ] com.simplesys#json-extender-typesafe_2.11;1.0.0-SNAPSHOT!json-extender-typesafe_2.11.jar (872ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/isc-misc_2.11/1.0.0-SNAPSHOT/isc-misc_2.11-1.0.0-20141125.141653-33.jar ...
[info]  [SUCCESSFUL ] com.simplesys#isc-misc_2.11;1.0.0-SNAPSHOT!isc-misc_2.11.jar (863ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/bonecp-wrapper_2.11/1.0.0-SNAPSHOT/bonecp-wrapper_2.11-1.0.0-20141125.141653-18.jar ...
[info]  [SUCCESSFUL ] com.simplesys#bonecp-wrapper_2.11;1.0.0-SNAPSHOT!bonecp-wrapper_2.11.jar (954ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/config-wrapper_2.11/1.0.0-SNAPSHOT/config-wrapper_2.11-1.0.0-20141125.141653-21.jar ...
[info]  [SUCCESSFUL ] com.simplesys#config-wrapper_2.11;1.0.0-SNAPSHOT!config-wrapper_2.11.jar (704ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/isc-wrapper_2.11/1.0.0-SNAPSHOT/isc-wrapper_2.11-1.0.0-20141125.141706-38.jar ...
[info]  [SUCCESSFUL ] com.simplesys#isc-wrapper_2.11;1.0.0-SNAPSHOT!isc-wrapper_2.11.jar (3529ms)
[info] downloading http://toucan.simplesys.lan/artifactory/repo/com/simplesys/scala-gen_2.11/1.0.0-SNAPSHOT/scala-gen_2.11-1.0.0-20141125.141713-20.jar ...
[info]  [SUCCESSFUL ] com.simplesys#scala-gen_2.11;1.0.0-SNAPSHOT!scala-gen_2.11.jar (1068ms)
[success] Total time: 146 s, completed 26.11.2014 12:22:46
sbt (dm-processing)> 
@OlegYch
Copy link
Contributor

OlegYch commented Dec 3, 2014

for me even non-snapshot deps sources are not downloaded
this seems to be caused by cached resolution, without it sources are getting downloaded

@OlegYch
Copy link
Contributor

OlegYch commented Dec 3, 2014

this also breaks gen-idea since it's no longer able to attach sources to libraries

@newffy
Copy link
Author

newffy commented Dec 5, 2014

Snapshot dependencies sources are not downloaded at all for us (independently of cached resolution)

@OlegYch
Copy link
Contributor

OlegYch commented Dec 5, 2014

can you try updateOptions := updateOptions.value.withCachedResolution(false).withLatestSnapshots(true) ?

@newffy
Copy link
Author

newffy commented Dec 6, 2014

as I said, we already tried it. No way.
with
updateOptions := updateOptions.value.withCachedResolution(false).withLatestSnapshots(true)

log is (for example):

sbt (dm-processing)> updateClassifiers
[info] Updating {file:/Users/newf/Documents/dev/dm-processing/}dm-processing...
[info] Resolving org.ow2.asm#asm-tree;5.0.1 ...
[info] downloading http://toucan.simplesys.lan/artifactory/repo/ru/simplesys/core-domains_2.11/1.2.1-SNAPSHOT/core-domains_2.11-1.2.1-20141206.004435-13.jar ...
[info]  [SUCCESSFUL ] ru.simplesys#core-domains_2.11;1.2.1-SNAPSHOT!core-domains_2.11.jar (579ms)
[info] Done updating.
[info] Resolving org.ow2.asm#asm-tree;5.0.1 ...
[success] Total time: 18 s, completed 06.12.2014 4:45:42

although sources was uploaded too, of course.

@eed3si9n eed3si9n added the area/library_management library management label Dec 9, 2014
@eed3si9n eed3si9n added this to the 0.13.8 milestone Dec 9, 2014
@eed3si9n
Copy link
Member

@OlegYch if cached resolution doesn't download sources, that's probably another issue. Could you create one for it?

@newffy Has downloading of SNAPSHOT source jars ever worked? Or is this something that 0.13.7 broke?

@newffy
Copy link
Author

newffy commented Dec 14, 2014

Well, it looks like it's broken since 0.13.2 or 0.13.1.
Last SBT version we used and it worked was 0.13.0
As far as I can remember at least :)

2014-12-14 16:37 GMT+03:00 eugene yokota [email protected]:

@OlegYch https://github.com/OlegYch if cached resolution doesn't
download sources, that's probably another issue. Could you create one for
it?

@newffy https://github.com/newffy Has downloading of SNAPSHOT source
jars ever worked? Or is this something that 0.13.7 broke?


Reply to this email directly or view it on GitHub
#1750 (comment).

@OlegYch
Copy link
Contributor

OlegYch commented Dec 15, 2014

created #1776
btw i just remembered another issue with updateClassifiers and snapshots mpeltonen/sbt-idea#306 , perhaps they are related

@eed3si9n eed3si9n modified the milestones: 0.13.9, 0.13.8 Mar 26, 2015
@eed3si9n eed3si9n added the ready label Mar 27, 2015
@dwijnand dwijnand self-assigned this Jun 6, 2015
@dwijnand
Copy link
Member

dwijnand commented Jun 7, 2015

I've been trying to reproduce this, but I can't, trying sbt 0.13.8, 0.13.7 and 0.13.6:

// build.sbt
        name := "t"
     version := "1.0"
scalaVersion := "2.11.6"

          resolvers += Resolver sonatypeRepo "snapshots"
libraryDependencies += "com.chuusai" %% "shapeless" % "2.2.1-SNAPSHOT"
> updateClassifiers
[info] Updating {file:/Users/dnw/Desktop/t/}t...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT.jar ...
[info]  [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar(bundle) (2553ms)
[info] Done updating.
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT-javadoc.jar ...
[info]  [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar(doc) (2502ms)
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT.jar ...
[info]  [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar (2025ms)
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT-sources.jar ...
[info]  [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar(src) (876ms)

@newffy Can you check if this bug is still present? And if so find a way to reproduce the problem with publicly available artifacts and repositories?

@newffy
Copy link
Author

newffy commented Jun 7, 2015

It's all right when you download snapshot deps at first time. After that if
you republish snaphshot deps and try updateClassifiers sbt won't download
sources and docs anymore, altough main jar will be downloaded.
That's why I don't how to reproduce it with publicly available artifacts,
you need to publish new snapshot to catch the problem.

2015-06-07 19:22 GMT+03:00 Dale Wijnand [email protected]:

I've been trying to reproduce this, but I can't, trying sbt 0.13.8, 0.13.7
and 0.13.6:

// build.sbt
name := "t"
version := "1.0"
scalaVersion := "2.11.6"

      resolvers += Resolver sonatypeRepo "snapshots"

libraryDependencies += "com.chuusai" %% "shapeless" % "2.2.1-SNAPSHOT"```

updateClassifiers
[info] Updating {file:/Users/dnw/Desktop/t/}t...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT.jar ...
[info] [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar(bundle) (2553ms)
[info] Done updating.
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT-javadoc.jar ...
[info] [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar(doc) (2502ms)
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT.jar ...
[info] [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar (2025ms)
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.11/2.2.1-SNAPSHOT/shapeless_2.11-2.2.1-SNAPSHOT-sources.jar ...
[info] [SUCCESSFUL ] com.chuusai#shapeless_2.11;2.2.1-SNAPSHOT!shapeless_2.11.jar(src) (876ms)

@newffy https://github.com/newffy Can you check if this bug still
present? And if so find a way to reproduce the problem with publicly
available artifacts and repositories?


Reply to this email directly or view it on GitHub
#1750 (comment).

@dwijnand
Copy link
Member

So seems like the way snapshot updates are handled is that the pom is downloaded and, if it's a newer pom, Ivy deletes the dependency jar from the Ivy cache, so then later it doesn't find it present, and re-downloads it.

For some reason the sources and javadoc configurations aren't present on the ModuleDescriptor for the dependency so that all 3 jars are deleted and re-downloaded.

Here's the code I'm talking about:

Seeking Ivy help!

@dwijnand
Copy link
Member

The sources and javadoc configurations might be missing because they're also missing in ivy-0.1.0-SNAPSHOT.xml.

Compare bippy vs scala-library:

<publications>
  <artifact name="sbt-gh1750-bippy_2.11" type="jar" ext="jar" conf="master"/>
</publications>
<dependencies>
  <dependency org="org.scala-lang" name="scala-library" rev="2.11.7" force="true"
    conf="compile->compile(*),master(compile);runtime->runtime(*)"
  />
</dependencies>

@dwijnand
Copy link
Member

Interestingly invoking deliver in bippy generates:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">

  <info organisation="com.dwijnand" module="sbt-gh1750-bippy_2.11"
    revision="0.1.0-SNAPSHOT" status="integration" publication="20150725004740"
  >
    <description>sbt-gh1750-bippy</description>
  </info>

  <configurations>
    <conf name="compile"  visibility="public" description=""/>
    <conf name="runtime"  visibility="public" description="" extends="compile"/>
    <conf name="test"     visibility="public" description="" extends="runtime"/>
    <conf name="provided" visibility="public" description=""/>
    <conf name="optional" visibility="public" description=""/>
    <conf name="sources"  visibility="public" description=""/>
    <conf name="docs"     visibility="public" description=""/>
    <conf name="pom"      visibility="public" description=""/>
  </configurations>

  <publications>
    <artifact name="sbt-gh1750-bippy_2.11" type="pom" ext="pom" conf="pom"/>
    <artifact name="sbt-gh1750-bippy_2.11" type="jar" ext="jar" conf="compile"/>
    <artifact name="sbt-gh1750-bippy_2.11" type="src" ext="jar" conf="sources" e:classifier="sources"/>
    <artifact name="sbt-gh1750-bippy_2.11" type="doc" ext="jar" conf="docs" e:classifier="javadoc"/>
  </publications>

  <dependencies>
    <dependency org="org.scala-lang" name="scala-library" rev="2.11.7"
      conf="compile->default(compile)"
    />
  </dependencies>
</ivy-module>

@dwijnand
Copy link
Member

Going back a little, it seems the sources and javadoc configuration don't have artifacts that Ivy can delete and re-download because the addSourcesAndJavadocArtifactsIfPresent code in Ivy is being blocked by sbt-specific code.

This leads me to git blame myself to d8b3118 and down the links that provides.

Seems there's lots of things going on here, Ivy things, Maven things, sbt overriding ivy things, sbt changing ivy things in ivy, wrong POM things.. as well as performance concerns.

So given this context I'm not sure how this bug should be solved.

@jsuereth
Copy link
Member

@dwijnand That's actually the desgin of sbt is to disable that feature. It turns out Ivy is issueing an http HEAD request to check existence of files before downloading. This is expensive, and it doesn't actually cache FAILURE (which maven does). Additionally, maven doesn't check existence of an artifact until it's asked for.

SO, what we're trying to do in sbt is mimic the maven style, but use the Ivy interfaces/API. That's why this is so wrong. We have two options:

  1. Fix the bug using all the current workarounds. This means you'll have to dive deeper to see why sources/javadoc are not updated. AFAIK, the mechanism we use to grab classifiers SHOULD NOT be inhibited by the code you've found, as we walk a different path to get there.
  2. Fix the underlying issue of Ivy's sources/classifier check performance via some kind of "negative cache" for artifacts, where we prevent looking if we've tried in the past X time-units.

We really really want to fix 2, because we think we could eek a lot of performance out of Ivy if we fix 2. TO resolve this bug you only have to fix 1, which I think may be something a bit smalelr and more paletable.

In any case, as I said in gitter, I'm still trying to think through (2) a bit more, as I'd like to nail a solution to that soon.

@jsuereth
Copy link
Member

@dwijnand It appears like the core issue here is related to the maven -SNAPSHOT and uniqueVersion fun. I can dive in, but I think the way we set up updateClassifiers: https://github.com/sbt/sbt/blob/0.13/main/src/main/scala/sbt/Defaults.scala#L1216-L1237

  1. We create DIRECT dependencies to all known transitive dependencies
  2. We create DIRECT artifacts to download for all classifiers (we actually don't handle the "sources" vs. "srcs" issue that exists for some dependencies)

I think what's happening is we're essentially asking for foo-bar-1.0-SNAPSHOT-sources.jar when we need foo-bar-1.0-<unique version>.jar. There's workaround in ivy for this that our code may not be hitting. We may need to dive deeper with our sources/javadoc workaround to fix the surface issue. Again, we could also just re-enable Ivy's normal handling of source/javadoc and instead fix the performance issue there.

@dwijnand
Copy link
Member

@jsuereth thanks for spending time looking into this, I truly need all the help I can get.

I'm not sure if this is to do with unique version, as, at least on Nexus rather than Artifactory, the sources jar is available as foo-bar-1.0-SNAPSHOT-sources.jar.

I'm happy to look into how to fix 2, as I've been working on this exclusively for two months now, I don't mind trying to fix it the best way possible.

But I wonder, if the desired result is, given the pom has a newer publication date, delete old jars so that the updated version can be downloaded, why not just try to delete any known, common classifier jars (like sources, srcs, javadoc) and then get them downloaded again. Is it better to have an outdated sources jar present if there's no updated sources jar available? But I guess this is the "fix 1" solution here.

I'll try reproducing the performance issue with a missing sources jar, removing that sbt override, and see if I can come up with a satisfactory failure cache to mitigate. It's a shame it means working in two repos/builds.

Again, thanks for your help.

@jsuereth
Copy link
Member

@dwijnand Anytime! I'm hoping I can help you out here eventually. Your idea to delete old jars when an updated version is downloaded actually sounds like it should work out as a "fix 1" workaround. COuld bear fruit.

As far as fix #2, I'd really like to just redo how Ivy caches from the ground up, and rewrite EVERY dependency resolver to use the new caching mechanism. We might even be able to make that work :)

@dwijnand
Copy link
Member

dwijnand commented Aug 6, 2015

I took some more detailed notes on the sequence of events, for the purposes of exploring both avenues, particularly so I can being to understand what things are called.

It's quite a wash of detail, mostly for me, but might be interesting in general, particularly if anything is or looks wrong.

The shared entry point of both update and updateClassifiers is IvyActions.updateEither

The entry point to Ivy from Sbt is
(ivy: Ivy).resolve(module: DefaultModuleDescriptor, resolveOptions: ResolveOptions)

eventually that calls SbtChainResolver, which is a ChainResolver, which is a DependencyResolver
the method is getDependency(dd: DependencyDescriptor (MergedDescriptors), data: ResolveData)

that ends up calling BasicResolver.getDependency(dd, data)

that extracts mrid: ModuleRevisionId from dd: DependencyDescriptor, which is ~= GAV

a variant of dd (nsDd) and data are used to call findIvyFileRefs, which returns ivyRef: ResolvedResource

ivyRef and another variant of dd (systemDd), and data are called to parse

that fetches a parser: ModuleDescriptorParser from ModuleDescriptorParserRegistry, by URLResource,
which returns sbt's CustomPomParser (deprecated) which is a ModuleDescriptorParser,

but the call is getMetadaTadataArtifact(mrid: ModuleRevisionId, res: Resource)
which just delegates to underlying PomModuleDescriptor
which returns moduleArtifact: Artifact (DefaultArtifact)

then a call to a RepositoryCacheManager is made,
the instance here is sbt's "default-cache",
which is essentially a DefaultRepositoryCacheManager
but overrides findModuleInCache(
  dd: DependencyDescriptor, mrid: ModuleRevisionId, options: CacheMetadataOptions, expectedResolver: String)

the call to "default-cache" DefaultRepositoryCacheManager is
  cacheModuleDescriptor(
    resolver       : DependencyResolver   (sbt's PluginCapabaleResolver, delegating to IBiblioResolver)
    mdRef          : ResolvedResource
    dd             : DependencyDescriptor (DefaultDependencyDescriptor)
    moduleArtifact : Artifact             (DefaultArtifact)
    downloader     : ResourceDownloader
    options        : CacheMetadataOptions
  )

there the POM artifact is force downloaded

then it gets parsed

the call stack uses ModuleDescritorMemoryCache and DefaultRepositoryCacheManager.MyModuleDescriptorProvider

and eventually calls
  (mdParser: ModuleDescriptorParser (PomModuleDescriptorParser)).parseDescriptor(
    ivySettings   : ParserSettings (ResolverParsingSettings)
    descriptorURL : URL
    res           : Resource       (URLResource)
    validate      : Boolean        (true)
  )

there, having populated a mdBuilder: PomModuleDescriptorBuilder
including adding its main artifact, unreservably

it calls
  PomModuleDescriptorBuilder.addSourcesAndJavadocArtifactsIfPresent(
    mdBuilder   : PomModuleDescriptorBuilder
    ivySettings : ParserSettings (ResolverParserSettings)
  )

there it fetches the resolver: DependencyResolver (SbtChainResolver) as such:

  ModuleDescriptor md = mdBuilder.getModuleDescriptor();        // returns PomModuleDescriptorBuilder
  ModuleRevisionId mrid = md.getModuleRevisionId();
  DependencyResolver resolver = ivySettings.getResolver(mrid);  // returns SbtChainResolver

then it calls resolver.locate(artifact: Artifact (MDArtifact))

however SbtChainResolver has an override that retuns null if artifact IvySbt.hasImplicitClassifier

so locating sources, src & javadoc returns null
so no source/src/javadoc artifacts are added to mdBuilder: PomModuleDescriptorBuilder

so md: ModuleDescriptor (DefaultModuleDescriptor) propagates up to "default-cache" DefaultRepositoryCacheManager

there as md's resolvedPublicationDate: Date doesn't match the cachedPublicationDate
deleteOldArtifacts is set to true

with deleteOldArtifacts == true
the configurations on md are iterated on
fetching the artifacts for each configuration,
to then delete them

but as source/src/javadoc artifacts weren't added to md,
these aren't found
so aren't deleted
so aren't re-downloaded

@dwijnand
Copy link
Member

dwijnand commented Aug 8, 2015

See sbt/ivy#15.

@dwijnand dwijnand added this to the 0.13.10 milestone Aug 11, 2015
dwijnand added a commit to sbt/ivy that referenced this issue Aug 27, 2015
Force deleting sources/javadoc to fix sbt/sbt#1750
jsuereth added a commit that referenced this issue Aug 31, 2015
@dwijnand dwijnand removed their assignment Jan 13, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/library_management library management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants