From 8016c1face1283952e228aee348487bf0421ab90 Mon Sep 17 00:00:00 2001 From: freya02 <41875020+freya022@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:33:01 +0200 Subject: [PATCH] Fix sources not being linked when using Maven (#3046) --- docs/topics/runners/dokka-maven.md | 5 ++++- runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/topics/runners/dokka-maven.md b/docs/topics/runners/dokka-maven.md index 14551c91d3..bc51d5fee1 100644 --- a/docs/topics/runners/dokka-maven.md +++ b/docs/topics/runners/dokka-maven.md @@ -407,7 +407,7 @@ function in `kotlinx.coroutines`. - ${project.basedir}/src + src https://github.com/kotlin/dokka/tree/master/src #L @@ -422,6 +422,9 @@ function in `kotlinx.coroutines`. The path to the local source directory. The path must be relative to the root of the current module.

+

+ Note: Only Unix based paths are allowed, Windows-style paths will throw an error. +

diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index ba95e7a70c..d14fea9c5b 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -389,7 +389,7 @@ public abstract class AbstractDokkaMojo( skipEmptyPackages = skipEmptyPackages, skipDeprecated = skipDeprecated, jdkVersion = jdkVersion, - sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, URL(it.url), it.lineSuffix) }.toSet(), + sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(File(it.path).canonicalPath, URL(it.url), it.lineSuffix) }.toSet(), perPackageOptions = perPackageOptions.map { @Suppress("DEPRECATION") // for includeNonPublic, preserve backwards compatibility PackageOptionsImpl(