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

Error using Scala 3.2.0 and 3.2.1-RC2: package scala.compiletime does not have a member method summonFrom #702

Closed
hmf opened this issue Sep 23, 2022 · 13 comments

Comments

@hmf
Copy link

hmf commented Sep 23, 2022

I am calling MDoc from a Mill script (forks a JVM).
I am using the latest 2.3.3 version of MDoc.
If I use the Scala version 3.1.3 it works correctly.
If I use Scala versions 3.2.0 or 3.2.1-RC2 I get the error:

rror: 
test.md:2 (mdoc generated code) 
 package scala.compiletime does not have a member method summonFrom
object MdocSession extends _root_.mdoc.internal.document.DocumentBuilder {

A search shows that this issue has been encountered before here and here.

Could this be a publishing issue?

TIA

@tgodzik
Copy link
Contributor

tgodzik commented Sep 23, 2022

Thanks for reporting! This should have been fixed by 2.3.3 actually, are you sure you are on the latest? Do you have reproduction or any example using mill with mdoc?

@hmf
Copy link
Author

hmf commented Sep 26, 2022

@tgodzik Let me try the latest. If it also does not work, I will set-up a project to reproduce this.

@hmf
Copy link
Author

hmf commented Sep 26, 2022

I have run this with 2.3.3 and 2.3.4 and have the same results. I will create an example project.

@tgodzik
Copy link
Contributor

tgodzik commented Sep 26, 2022

Actually, what do you use to run mdoc? It needs to be fixed there actually to bring in the newest Scala library and compiler.

@hmf
Copy link
Author

hmf commented Sep 26, 2022

@tgodzik I have set up this project that uses Mill to start an MDoc process to compile the files Markdown files. I don know if you are familiar with Mill, so a quick rundown:

The build script is in build.sc. This is a Scala 2 file and all the relevant code is found in the object tutorial. The Scala version is set here. The MDoc version is set here. Here I set the path to the Markdown sources (./tutorial/docs). I only have one source file in this module (test.md). To invoke MDoc I call the mdoc.

Here is an example of calling MDoc:

user@node:~/VSCodeProjects/mdocMill$ ./mill -i tutorial.mdoc

For this setup:

val ScalaVersion         = "3.2.1-RC2" // "3.2.1-RC2" "3.2.1-RC1" "3.2.0" "3.1.3"
  def scalaMdocVersion = T("2.3.4") // "2.3.4" "2.3.3" "2.2.4"

I get:

[40/40] tutorial.mdoc 
info: Compiling 1 file to /home/hmf/VSCodeProjects/mdocMill/out/tutorial/mdoc.dest
error: 
test.md:2 (mdoc generated code) 
 package scala.compiletime does not have a member method summonFrom
object MdocSession extends _root_.mdoc.internal.document.DocumentBuilder {
...

I get the same results for MDoc 2.3.3. Only for version 3.1.3 of Scala does this work for both versions of MDoc.

To facilitate debugging I can show the classpath used to call MDoc by un-commenting this line (just uncomment and run the mdoc target again). Below is the list of Jars used in the classpth to invoke MDoc. The version number seems to be ok. Can you confirm?

List of jars used in classpath
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/mdoc_3/2.3.4/mdoc_3-2.3.4.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/3.1.3/scala3-compiler_3-3.1.3.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/mdoc-runtime_3/2.3.4/mdoc-runtime_3-2.3.4.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/mdoc-cli_3/2.3.4/mdoc-cli_3-2.3.4.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.1.3/scala3-library_3-3.1.3.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/scalameta_2.13/4.5.13/scalameta_2.13-4.5.13.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/io/methvin/directory-watcher/0.16.1/directory-watcher-0.16.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/io/undertow/undertow-core/2.2.19.Final/undertow-core-2.2.19.Final.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/xnio/xnio-nio/3.8.8.Final/xnio-nio-3.8.8.Final.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.2/slf4j-api-2.0.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/geirsson/metaconfig-typesafe-config_3/0.11.1/metaconfig-typesafe-config_3-0.11.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/fansi_3/0.4.0/fansi_3-0.4.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/pprint_3/0.7.3/pprint_3-0.7.3.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-interfaces/3.1.3/scala3-interfaces-3.1.3.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/tasty-core_3/3.1.3/tasty-core_3-3.1.3.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-asm/9.2.0-scala-1/scala-asm-9.2.0-scala-1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/compiler-interface/1.3.5/compiler-interface-1.3.5.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline-reader/3.19.0/jline-reader-3.19.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline-terminal/3.19.0/jline-terminal-3.19.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline-terminal-jna/3.19.0/jline-terminal-jna-3.19.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/mdoc-interfaces/2.3.4/mdoc-interfaces-2.3.4.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/interface/1.0.9/interface-1.0.9.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-all/0.62.2/flexmark-all-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.8/scala-library-2.13.8.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/parsers_2.13/4.5.13/parsers_2.13-4.5.13.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scalap/2.13.8/scalap-2.13.8.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/xnio/xnio-api/3.8.8.Final/xnio-api-3.8.8.Final.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/geirsson/metaconfig-core_3/0.11.1/metaconfig-core_3-0.11.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/typesafe/config/1.4.1/config-1.4.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/sourcecode_3/0.3.0/sourcecode_3-0.3.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.19.2/protobuf-java-3.19.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/util-interface/1.3.0/util-interface-1.3.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark/0.62.2/flexmark-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-abbreviation/0.62.2/flexmark-ext-abbreviation-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-admonition/0.62.2/flexmark-ext-admonition-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-anchorlink/0.62.2/flexmark-ext-anchorlink-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-aside/0.62.2/flexmark-ext-aside-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-attributes/0.62.2/flexmark-ext-attributes-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-autolink/0.62.2/flexmark-ext-autolink-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-definition/0.62.2/flexmark-ext-definition-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-emoji/0.62.2/flexmark-ext-emoji-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-enumerated-reference/0.62.2/flexmark-ext-enumerated-reference-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-escaped-character/0.62.2/flexmark-ext-escaped-character-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-footnotes/0.62.2/flexmark-ext-footnotes-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-gfm-issues/0.62.2/flexmark-ext-gfm-issues-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-gfm-strikethrough/0.62.2/flexmark-ext-gfm-strikethrough-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-gfm-tasklist/0.62.2/flexmark-ext-gfm-tasklist-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-gfm-users/0.62.2/flexmark-ext-gfm-users-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-gitlab/0.62.2/flexmark-ext-gitlab-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-jekyll-front-matter/0.62.2/flexmark-ext-jekyll-front-matter-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-jekyll-tag/0.62.2/flexmark-ext-jekyll-tag-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-media-tags/0.62.2/flexmark-ext-media-tags-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-macros/0.62.2/flexmark-ext-macros-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-ins/0.62.2/flexmark-ext-ins-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-xwiki-macros/0.62.2/flexmark-ext-xwiki-macros-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-superscript/0.62.2/flexmark-ext-superscript-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-tables/0.62.2/flexmark-ext-tables-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-toc/0.62.2/flexmark-ext-toc-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-typographic/0.62.2/flexmark-ext-typographic-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-wikilink/0.62.2/flexmark-ext-wikilink-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-yaml-front-matter/0.62.2/flexmark-ext-yaml-front-matter-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-ext-youtube-embedded/0.62.2/flexmark-ext-youtube-embedded-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-html2md-converter/0.62.2/flexmark-html2md-converter-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-jira-converter/0.62.2/flexmark-jira-converter-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-pdf-converter/0.62.2/flexmark-pdf-converter-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-profile-pegdown/0.62.2/flexmark-profile-pegdown-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-ast/0.62.2/flexmark-util-ast-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-builder/0.62.2/flexmark-util-builder-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-collection/0.62.2/flexmark-util-collection-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-data/0.62.2/flexmark-util-data-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-dependency/0.62.2/flexmark-util-dependency-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-format/0.62.2/flexmark-util-format-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-html/0.62.2/flexmark-util-html-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-misc/0.62.2/flexmark-util-misc-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-options/0.62.2/flexmark-util-options-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-sequence/0.62.2/flexmark-util-sequence-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util-visitor/0.62.2/flexmark-util-visitor-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-youtrack-converter/0.62.2/flexmark-youtrack-converter-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/trees_2.13/4.5.13/trees_2.13-4.5.13.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.8/scala-compiler-2.13.8.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/geirsson/metaconfig-pprint_3/0.11.1/metaconfig-pprint_3-0.11.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/typelevel/paiges-core_3/0.4.2/paiges-core_3-0.4.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_3/2.5.0/scala-collection-compat_3-2.5.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.8/scala-reflect-2.13.8.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/vladsch/flexmark/flexmark-util/0.62.2/flexmark-util-0.62.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/nibor/autolink/autolink/0.6.0/autolink-0.6.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jsoup/jsoup/1.11.3/jsoup-1.11.3.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/openhtmltopdf/openhtmltopdf-core/1.0.0/openhtmltopdf-core-1.0.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/openhtmltopdf/openhtmltopdf-pdfbox/1.0.0/openhtmltopdf-pdfbox-1.0.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/openhtmltopdf/openhtmltopdf-rtl-support/1.0.0/openhtmltopdf-rtl-support-1.0.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/openhtmltopdf/openhtmltopdf-jsoup-dom-converter/1.0.0/openhtmltopdf-jsoup-dom-converter-1.0.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jetbrains/annotations/15.0/annotations-15.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/common_2.13/4.5.13/common_2.13-4.5.13.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/fastparse-v2_2.13/2.3.1/fastparse-v2_2.13-2.3.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline/3.21.0/jline-3.21.0.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/pdfbox/pdfbox/2.0.16/pdfbox-2.0.16.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/pdfbox/xmpbox/2.0.16/xmpbox-2.0.16.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/de/rototor/pdfbox/graphics2d/0.24/graphics2d-0.24.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/ibm/icu/icu4j/59.1/icu4j-59.1.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.13/0.11.11/scalapb-runtime_2.13-0.11.11.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/pdfbox/fontbox/2.0.16/fontbox-2.0.16.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/com/thesamet/scalapb/lenses_2.13/0.11.11/lenses_2.13-0.11.11.jar

@tgodzik
Copy link
Contributor

tgodzik commented Sep 26, 2022

It seems you should exclude the Scala version brought in by Mdoc and just use whichever is needed for the project. That's what is done in the sbt plugin and it works.

Mdoc is built with 3.1.3 to be compatible for all the downstream versions, so the default dependency will be Scala 3.1.3, which can't read Scala 3.2.x

@hmf
Copy link
Author

hmf commented Sep 26, 2022

I see. All scala-lang jars must use the project Scala version, not MDocs. Need to see how best to do this. Thank you.

@mbovel
Copy link

mbovel commented May 7, 2023

I have a similar problem when trying to add a dependency:

coursier launch org.scalameta:mdoc_3:2.3.7 -- \
		--classpath "$(coursier fetch -p com.typesafe.akka:akka-testkit_3:2.8.1 ch.qos.logback:logback-classic:1.4.7)" \
		--in test.md \
		--out test-out.md

Where test.md has the following content:

```scala mdoc
println(42)
```

I get the following error many times:

error: 
ex-09.md:2 (mdoc generated code) 
 package scala.compiletime does not have a member method summonFrom
object MdocSession extends _root_.mdoc.internal.document.DocumentBuilder {

coursier fetch com.typesafe.akka:akka-testkit_3:2.8.1 ch.qos.logback:logback-classic:1.4.7 outputs:

/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/typesafe/akka/akka-testkit_3/2.8.1/akka-testkit_3-2.8.1.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.4.7/logback-classic-1.4.7.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/typesafe/akka/akka-actor_3/2.8.1/akka-actor_3-2.8.1.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.2.2/scala3-library_3-3.2.2.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-core/1.4.7/logback-core-1.4.7.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.4/slf4j-api-2.0.4.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/typesafe/config/1.4.2/config-1.4.2.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-java8-compat_3/1.0.0/scala-java8-compat_3-1.0.0.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar

I suspect the problem is due to scala3-library being included in the class path.

Without com.typesafe.akka:akka-testkit_3:2.8.1, the initial command works.

coursier fetch ch.qos.logback:logback-classic:1.4.7 outputs:

/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.4.7/logback-classic-1.4.7.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-core/1.4.7/logback-core-1.4.7.jar
/Users/mbovel/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.4/slf4j-api-2.0.4.jar

Any idea how I could fix this?

I tried setting the Scala version by adding --site.SCALA_VERSION=3.2.2. Didn't help.

@tgodzik
Copy link
Contributor

tgodzik commented May 9, 2023

Your cases seems to work correctly for me 🤔

coursier launch org.scalameta:mdoc_3:2.3.7 -- --classpath "(coursier fetch -p com.typesafe.akka:akka-testkit_3:2.8.1 ch.qos.logback:logback-classic:1.4.7)" --in markdown.md --out test-out.md
info: Compiling 1 file to /home/tgodzik/Documents/workspaces/mdoc-test/test-out.md
info: Compiled in 1.88s (0 errors)

You might need to exclude the Scala jars coming from mdoc so some options might be:

  • use --scala-version "3.2.2" and see if it forces the version
  • use --force-version scala-lang:scala3-library_3:3.2.2 --force-version scala-lang:scala3-compiler_3:3.2.2 might need some more like we do in mdoc sbt plugin or in metals

We could probably declare an app on coursier-apps for that with everything set up.

Please let me know if any of the suggestions work, I will try to reproduce again

@tgodzik
Copy link
Contributor

tgodzik commented May 9, 2023

Ok, this should work:

coursier launch  --force-version org.scala-lang:scala3-compiler_3:3.2.2 org.scalameta:mdoc_3:2.3.7  -- --classpath (coursier fetch -p com.typesafe.akka:akka-testkit_3:2.8.1 ch.qos.logback:logback-classic:1.4.7) --in markdown.md --out test-out.md

so basically adding --force-version org.scala-lang:scala3-compiler_3:3.2.2

Might be good to do mdoc3 app with that defined if anyone is interested

@hmf
Copy link
Author

hmf commented May 10, 2023

@tgodzik

Might be good to do mdoc3 app with that defined if anyone is interested

I may have missed it in the documentation, but I would say that if this is well documented it would be enough. Maybe here? This would save effort in the future whenever new version of the compiler come out, right?

@mbovel
Copy link

mbovel commented May 10, 2023

Thanks, @tgodzik, using --force-version works for me!

coursier launch  --force-version org.scala-lang:scala3-compiler_3:3.2.2 org.scalameta:mdoc_3:2.3.7  -- --classpath $(coursier fetch -p com.typesafe.akka:akka-testkit_3:2.8.1 ch.qos.logback:logback-classic:1.4.7) --in markdown.md --out test-out.md

(There is just a $ missing at $(coursier fetch in your last bash snippet)

If I don't use --force-version, then I get the errors described in my previous comment.

@tgodzik
Copy link
Contributor

tgodzik commented May 10, 2023

(There is just a $ missing at $(coursier fetch in your last bash snippet)

I was using another shell, sorry 😓

@tgodzik

Might be good to do mdoc3 app with that defined if anyone is interested

I may have missed it in the documentation, but I would say that if this is well documented it would be enough. Maybe here? This would save effort in the future whenever new version of the compiler come out, right?

Sure, we can add one paragraph about it, but probably it would be useful to have a separate app also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants