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

mvnd does not load from svc/.mvn if -f svc/pom.xml is applied (mvn does) #694

Closed
atamanroman opened this issue Sep 28, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@atamanroman
Copy link

atamanroman commented Sep 28, 2022

mvnd differs from mvn in how it loads from .mvn when -f is applied.

MWE: https://github.com/atamanroman/mvnd-dotmaven-subdirectory

Expected behaviour:

mvn(d) loads the necessary --add-{exports,opens} from svc/.mvn/jvm.config, even with -f svc/pom.xml.

Actual behaviour:

mvn loads the necessary --add-{exports,opens} from svc/.mvn/jvm.config, even with -f svc/pom.xml.
mvnd does not.

Context:

$ mvn --version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /usr/local/Cellar/maven/3.8.6/libexec
Java version: 17.0.4.1, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "12.6", arch: "x86_64", family: "mac"

$ mvnd --version
mvnd 0.8.1 darwin-amd64 native client (821c6a54a20ce4c4a2b94419334aaf125a128caf)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jansi.osx.OsXNativePty
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /usr/local/Cellar/mvnd/0.8.1/libexec/mvn
Java version: 17.0.4.1, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "12.6", arch: "x86_64", family: "mac"

Output with mvn in svc/ (GOOD):

repro/svc @ main
$ mvn --quiet verify && echo OK
OK

Output with mvnd in scv/ (GOOD):

repro/svc @ main
$ mvnd --quiet verify && echo OK
OK

Output with mvn -f svc/pom.xml (GOOD):

repro @ main
$ mvn --quiet -f svc/pom.xml verify && echo OK
OK

Output with mvnd -f svc/pom.xml (BAD):

repro @ main
$ mvnd --quiet -f svc/pom.xml verify && echo OK
[WARN] [stderr] An exception has occurred in the compiler (17.0.4.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
[WARN] [stderr] java.lang.IllegalAccessError: class com.google.errorprone.BaseErrorProneJavaCompiler (in unnamed module @0x35b09011) cannot access class com.sun.tools.javac.api.BasicJavacTask (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.api to unnamed module @0x35b09011
...
[ERROR] COMPILATION ERROR :
[ERROR] An unknown compilation problem occurred
...
@atamanroman atamanroman changed the title Bug with -f and .mvn directory next to pom.xml mvnd does not load from svc/.mvn if -f svc/pom.xml is applied (mvn does) Sep 28, 2022
@gnodet
Copy link
Contributor

gnodet commented Sep 29, 2022

I can't build the project. It always give me the following result:

➜  svc git:(main) ✗ mvn verify   
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------< com.github.atamanroman:mvnd-jvm-options-subdir-bug >---------
[INFO] Building mvnd-jvm-options-subdir-bug 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mvnd-jvm-options-subdir-bug ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/gnodet/work/tmp/mvnd-dotmaven-subdirectory/svc/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ mvnd-jvm-options-subdir-bug ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/gnodet/work/tmp/mvnd-dotmaven-subdirectory/svc/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/gnodet/work/tmp/mvnd-dotmaven-subdirectory/svc/src/main/java/Hello.java:[6,17] [ReturnValueIgnored] Return value of 'getBytes' must be used
    (see https://errorprone.info/bugpattern/ReturnValueIgnored)
  Did you mean to remove this line?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.791 s
[INFO] Finished at: 2022-09-29T21:39:10+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project mvnd-jvm-options-subdir-bug: Compilation failure
[ERROR] /Users/gnodet/work/tmp/mvnd-dotmaven-subdirectory/svc/src/main/java/Hello.java:[6,17] [ReturnValueIgnored] Return value of 'getBytes' must be used
[ERROR]     (see https://errorprone.info/bugpattern/ReturnValueIgnored)
[ERROR]   Did you mean to remove this line?
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
➜  svc git:(main) ✗  

@atamanroman
Copy link
Author

@gnodet Sorry, sometimes I'm stupid 🤦

Right code is online and you can see a screen recording here: https://asciinema.org/a/524708

gnodet added a commit to gnodet/mvnd that referenced this issue Sep 30, 2022
@gnodet gnodet added this to the 0.8.2 milestone Sep 30, 2022
@gnodet gnodet added the bug Something isn't working label Sep 30, 2022
@gnodet gnodet self-assigned this Sep 30, 2022
gnodet added a commit to gnodet/mvnd that referenced this issue Oct 3, 2022
gnodet added a commit to gnodet/mvnd that referenced this issue Oct 3, 2022
@gnodet gnodet closed this as completed in aacd3eb Oct 3, 2022
theit pushed a commit to theit/maven-mvnd that referenced this issue Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants