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

Read Scala options from pom.xml #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

carlosedp
Copy link

This PR adds POM parsing to fetch Scala compiler options defined in the scala-maven-plugin configuration.

The environment variable still have preference if passed.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Sorry, I completely missed this PR.

I can see why you would want that and I think we have a similar thing for Kotlin in core Quarkus.
I don't think this is the right approach though as we end up having something really tied to Maven in the extension implementation.

The Kotlin part is in two parts:

So what I would recommend:

  • implement the first approach in the extension to have a workaround for now
  • and then the second approach would need some additional work in Quarkus core to make it pluggable (and the Kotlin part should be moved to the Kotlin extension too). If you want to pursue this, it's probably a good idea to ask @aloubyansky to ask for advice about the design.

HTH.

@carlosedp
Copy link
Author

Thanks for the comment @gsmet ... I've revisited this and done a couple tests and found the compiler arguments set in scala-maven-plugin -> configuration -> args already applies to the dev mode:

Before:

❯ quarkus dev
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< org.acme:scala3-quarkus-quickstart >-----------------
[INFO] Building scala3-quarkus-quickstart 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus:3.7.1:dev (default-cli) @ scala3-quarkus-quickstart ---
[INFO] Invoking scala:4.8.1:add-source (scala-compile-first) @ scala3-quarkus-quickstart
[INFO] Invoking scala:4.8.1:compile (scala-compile-first) @ scala3-quarkus-quickstart
[INFO] compiling 17 Scala sources to /Users/cdepaula/repos/scala/scala3-quarkus-quickstart/target/classes ...
[WARNING] /Users/cdepaula/repos/scala/scala3-quarkus-quickstart/src/main/scala/org/acme/GreetingResource.scala:5:13: unused import
[WARNING] one warning found
[INFO] done compiling
[INFO] compile in 8.0 s
[INFO] Invoking resources:3.3.1:resources (default-resources) @ scala3-quarkus-quickstart
...

After adding <arg>-Werror</arg> to pom.xml:

❯ quarkus dev
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< org.acme:scala3-quarkus-quickstart >-----------------
[INFO] Building scala3-quarkus-quickstart 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus:3.7.1:dev (default-cli) @ scala3-quarkus-quickstart ---
[INFO] Invoking scala:4.8.1:add-source (scala-compile-first) @ scala3-quarkus-quickstart
[INFO] Invoking scala:4.8.1:compile (scala-compile-first) @ scala3-quarkus-quickstart
[INFO] compiling 17 Scala sources to /Users/cdepaula/repos/scala/scala3-quarkus-quickstart/target/classes ...
[ERROR] /Users/cdepaula/repos/scala/scala3-quarkus-quickstart/src/main/scala/org/acme/GreetingResource.scala:5:13: unused import
[ERROR] one error found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.611 s
[INFO] Finished at: 2024-02-02T15:12:19-03:00
[INFO] ------------------------------------------------------------------------

So I understand the change in this PR and the suggestion you made is not needed. Right?

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

Successfully merging this pull request may close these issues.

2 participants