diff --git a/core/shared/src/main/scala/coursier/core/Repository.scala b/core/shared/src/main/scala/coursier/core/Repository.scala index 2d0f96dcf..297f95f9a 100644 --- a/core/shared/src/main/scala/coursier/core/Repository.scala +++ b/core/shared/src/main/scala/coursier/core/Repository.scala @@ -38,29 +38,6 @@ object Repository { ) .withDefaultChecksums )) - def withJavadocSources: Artifact = { - val base = underlying.url.stripSuffix(".jar") - underlying.copy(extra = underlying.extra ++ Seq( - "sources" -> Artifact( - base + "-sources.jar", - Map.empty, - Map.empty, - Attributes("jar", "src"), // Are these the right attributes? - changing = underlying.changing - ) - .withDefaultChecksums - .withDefaultSignature, - "javadoc" -> Artifact( - base + "-javadoc.jar", - Map.empty, - Map.empty, - Attributes("jar", "javadoc"), // Same comment as above - changing = underlying.changing - ) - .withDefaultChecksums - .withDefaultSignature - )) - } } } diff --git a/core/shared/src/main/scala/coursier/maven/MavenSource.scala b/core/shared/src/main/scala/coursier/maven/MavenSource.scala index 26973836d..06921e82d 100644 --- a/core/shared/src/main/scala/coursier/maven/MavenSource.scala +++ b/core/shared/src/main/scala/coursier/maven/MavenSource.scala @@ -11,6 +11,32 @@ case class MavenSource( import Repository._ import MavenRepository._ + private implicit class DocSourcesArtifactExtensions(val underlying: Artifact) { + def withJavadocSources: Artifact = { + val base = underlying.url.stripSuffix(".jar") + underlying.copy(extra = underlying.extra ++ Seq( + "sources" -> Artifact( + base + "-sources.jar", + Map.empty, + Map.empty, + Attributes("jar", "src"), // Are these the right attributes? + changing = underlying.changing + ) + .withDefaultChecksums + .withDefaultSignature, + "javadoc" -> Artifact( + base + "-javadoc.jar", + Map.empty, + Map.empty, + Attributes("jar", "javadoc"), // Same comment as above + changing = underlying.changing + ) + .withDefaultChecksums + .withDefaultSignature + )) + } + } + def artifacts( dependency: Dependency, project: Project