Producing a site from many projects, internal and external

Hey there,

I’m putting a documentation site together that consists of a couple of sbt sub-projects that generate paradox doco. The site also spans multiple external projects and so I’m thinking of using sbt-site to consolidate everything. I was hoping that I could discuss the approach I have in mind here.

In particular, I’d like to bring in a Javadoc jar that has already been published to a repository. Any pointers re. how I might feed the Javadoc to sbt-site would be great. It appears as though I should create mappings from a jar (somehow).

Thanks for any guidance.

Kind regards,
Christopher

For Tech Hub I think we just grab javadoc jars from Maven Central using curl and unzip it from some sbt task. Maybe someone should contribute that (using already-published Javadoc) as a feature of sbt-site.

Great - thanks - if I work it out then I’ll offer a contribution. :-)

1 Like

Following up, so far I’ve managed to work out:

lazy val retrieveModule = taskKey[Either[UnresolvedWarning, Vector[File]]]("Retrieves a module")
retrieveModule := {
  val lm = {
    import sbt.librarymanagement.ivy._
    val ivyConfig = InlineIvyConfiguration().withLog(streams.value.log).withOtherResolvers(Vector(Resolver.defaultLocal))
    IvyDependencyResolution(ivyConfig)
  }
  lm.retrieve(library.coreDoc, scalaModuleInfo = None, new File("target"), streams.value.log)
}

…but get:

[warn] 	module not found: com.github.huntc#core;0.10.1-64-ga75c810
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/github/huntc/core/0.10.1-64-ga75c810/core-0.10.1-64-ga75c810.pom

… i.e. it only resolves against Maven Central. I was hoping that the withOtherResolvers would help here as my artifact is in a local repo. Any further pointers?

Cheers,
-C

As a follow up - I’ve abandoned this approach as I couldn’t figure it out after spending quite a few hours on it. I’m using RootProject to reference other projects instead - accepting the caveats.

Here’s my final site building approach, in case there’s interest:


val Operations = config("operations")
val SdkReference = config("sdk-reference")

lazy val sdk1 = RootProject(file("../sdk-1"))
lazy val sdk2 = RootProject(file("../sdk-2"))
lazy val sdk3 = RootProject(file("../sdk-3"))

lazy val cover = project
  .in(file("cover"))
  .enablePlugins(ParadoxPlugin, ScalaUnidocPlugin)
  .settings(
    ParadoxSitePlugin.paradoxSettings(Operations),
    sourceDirectory in Operations := (sourceDirectory in (Compile, paradox) in operations).value,
    siteSubdirName in Operations := "operations",

    ParadoxSitePlugin.paradoxSettings(SdkReference),
    sourceDirectory in SdkReference := (sourceDirectory in (Compile, paradox) in sdkReference).value,
    siteSubdirName in SdkReference := "sdkReference",

    siteSubdirName in ScalaUnidoc := "latest/api",
    addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc)
  )
  .dependsOn(sdk1, sdk2, sdk3)