Comments (10)
I'm glad you finally found out why you were running with Java 8 👍
I still believe that the plugin is buggy since it's behavior is erratic: you can make it to call a different Java version than the one is used by the project (like 8 in my case)
This has nothing to do with the plugin. Maven (and Gradle, and pretty much all Java applications) will run with the java
version that you have configured on your system, and not having any java
in the search PATH
is the root of your problems. Properly setting your development environment is out of scope here.
The JDK version in your POM is only meaningful for the Maven Compiler Plugin. This plugin does nothing with it. It allows you to do things like compile with JDK 21 but produce 17 bytecode.
Switching JAVA_HOME
and PATH
to the desired JDK version is what everybody do (and the reason why things like SDKMAN exist), but even if you are unable/unwilling to set them properly, you can still configure Maven Toolchains
from micronaut-maven-plugin.
I added the project to my GitHub account for your convenience: aotdemo.
Funny thing is, the error does not reproduce on a MacBook Pro machine 😟
from micronaut-maven-plugin.
You are running with Java 8 which is not supported by Micronaut 4.
from micronaut-maven-plugin.
@alvarosanchez I am sorry but you were too quick to dismiss it. I am NOT using Java 8 , I am using Java 17.
Tagging with "cannot reproduce" is just lazy, since you can reproduce it easily on a Windows machine if you bother to clone the aotdemo project and try to build it on a Windows machine.
Very dissapointed with the way you handled it.
from micronaut-maven-plugin.
@nedelva no need to be so disrespectful.
If you care enough to read your own details, you will find that:
io/micronaut/maven/testresources/TestResourcesLifecycleExtension has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
So even if you think you are running with Java 17 (class file version 61.0), you are not. You are running with Java 8 (version 52.0).
Besides, mn:aot-sample-config
is tested on CI with Java 17 and Java 21 and even on Windows.
But if this weren't enough, I did take the time to try to reproduce it locally (look at the timestamps):
Nevertheless, you always have the chance to provide more context and/or request for this issue to be reopened. I didn't lock this conversation.
Next time, I would appreciate it if you could show more respect for an OSS contributor.
from micronaut-maven-plugin.
@alvarosanchez I think my objections still stand. What you are showing me is
- a demo project build on Mac (NOT on a Windows machine) -- I also mentioned that the issue does not reproduce on a Mac
- a few builds of the plugin itself on Docker instances (NOT the same thing as using the plugin to build!)
None of the above disproves my claims. I urge you to actually try to build the sample project on a Windows machine and you will see that the issue does occur indeed.
from micronaut-maven-plugin.
Why you keep ignoring this?
this version of the Java Runtime only recognizes class file versions up to 52.0
You are running with Java 8. But if you insist on making this more embarrassing, here's a screenshot of your project running on a Windows machine:
from micronaut-maven-plugin.
My submissions for the image gallery contest 🥇
The project settings, where you can see I use JDK 21 in fact:
Also don't forget that is not possible to execute the build with java 8 since the POM specifies the properties
<jdk.version>17</jdk.version>
<release.version>17</release.version>
See here what running from command prompt gives me. First, I set the JAVA_HOME
environment variable:
But I think the clue to the puzzle can be seen in the second image of the run (see my red underline)
@alvarosanchez Here's the trick question for you: If on a Windows machine there are several Java JDK versions installed, which one is picked when the plugin invokes the command java
? 😈
(I admit, I unintentionally threw you on a wrong path by forgetting to mention that I have SEVERAL JDKs installed on my machine)
from micronaut-maven-plugin.
JAVA_HOME
is not enough. Your PATH
is pointing to a Java 8 installation.
Running mvn --version
(or even java -version
) will tell you this info.
from micronaut-maven-plugin.
Ok, I will save you the trouble to find out yourself what's going on exactly. See, on my machine there was also Java 8 installed via the MSI installer. This thing modifies the Windows registry so I did not need to use JAVA_HOME nor the PATH variables to invoke java on the command prompt.
Because of this, when the 'java' was invoked by the plugin, it was picking Java 8 because there was NOTHING on the PATH variable to point to a different version.
I remedied the situation by
- Uninstalling the Java 8 JDK using the Control Panel and
- I added several full paths to the
bin
directory for each of the JDKs into the user's PATH variable. Now invokingjava
picks up whichever version is found first (here 21):
I am happy that I have gotten past the issue and found a workaround. I still believe that the plugin is buggy since it's behavior is erratic: you can make it to call a different Java version than the one is used by the project (like 8 in my case). But I am certain you could easily spot now the trouble with current arrangement.
from micronaut-maven-plugin.
Related Issues (20)
- micronaut-maven-plugin outputs unnecessary log information regardless of Maven Command Execution HOT 1
- Generate factory class with bean imports from dependencies HOT 2
- Docker Native packaging fails if there is an existing args file in the target directory
- Agent support for Native image Building
- dockerBuildNative fails due to native-image args parsing errors on windows HOT 1
- mn:run shuts down the test resources service after compile and doesn't restart it. HOT 3
- Add a way to run the test resource service as a non-daemon process HOT 3
- Multimodule project cannot contain multiple micronaut applications HOT 1
- Docker Native packaging shouldn't require the GraalVM profile
- Building packaged docker native image failing with 4.1.4 HOT 5
- Overriding native build base image
- Docker build is using non-existent image HOT 1
- Issue building docker native image on Windows 11 with maven and micronaut 4.2.0 HOT 3
- Configuration to provide JAR classifier name HOT 1
- Add additional layers to the Docker images
- Make it easier to use Oracle GraalVM (GFTC) base build image instead of GraalVM Community Edition
- Use different default base images for Oracle Functions with GraalVM native image
- Add Java 21 support for native image builds HOT 1
- Use generateResourceConfig and generateTestResourceConfig from NBT plugin instead of graalvm-resources goal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micronaut-maven-plugin.