maven-wrapper.properties is ignored?

已回答

IntelliJ Idea CE 2021.2:

My Maven setup looks like this in the preferences:

My project does have a maven-wrapper.properties:

which contains:

distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

However, when running any maven target, I get the error: "03:57 Error running 'demo [clean,install]': No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system."

Now don't get me wrong, I know ways to get around this, but since my setup seems sound, the should work. Why does it not?

0

After looking into the logs, here is the stack trace:

org.jetbrains.idea.maven.execution.MavenExternalParameters$ProjectSettingsOpenerExecutionException: No valid Maven installation found. Either set the home directory in the <a href="#">configuration dialog</a> or set the M2_HOME environment variable on your system.
at org.jetbrains.idea.maven.execution.MavenExternalParameters.createExecutionException(MavenExternalParameters.java:491)
at org.jetbrains.idea.maven.execution.MavenExternalParameters.resolveMavenHome(MavenExternalParameters.java:453)
at org.jetbrains.idea.maven.execution.MavenExternalParameters.createJavaParameters(MavenExternalParameters.java:106)
at org.jetbrains.idea.maven.execution.MavenRunConfiguration.createJavaParameters(MavenRunConfiguration.java:127)
at org.jetbrains.idea.maven.execution.MavenRunConfiguration$MavenCommandLineState.createJavaParameters(MavenRunConfiguration.java:407)

And that createExecutionException is called because MavenUtil#resolveMavenHomeDirectory did not succeed, and indeed (https://github.com/JetBrains/intellij-community/blob/master/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.java) it does not seem to be looking at any point for any wrapper.

0

Also when I do try to define a Maven path in the settings to replace the Bundled maven (mine is more recent), when I browse for the directory, and pick it, I get a spinner that never finishes and Intellij just freezes to the point I must violently shut it down.

So if I summarise, the Maven wrapper works for all the importing stuff and all, but when trying to invoke maven from the Maven pan or the "Run anything" window, it does not, and I cannot even override with my own Maven, so the only way I see to use Maven in those, is the Bundled one.

And that is fine, but I should be able to override that, especially since it looks like I can, but I cannot.

0

请先登录再写评论。