Maven build Compilation error : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven
Asked Answered
A

32

134

I have a maven project forked and cloned from a git repo onto my eclipse. It is build on Java 8. The first thing i do is perform a

mvn clean install

But I get following failure message:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Maven ---
[INFO] Deleting /Users/vshukla/git/Prism/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Maven ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/vshukla/git/Prism/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 66 source files to /Users/vshukla/git/Prism/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/scanUtility.java:[54,52] diamond operator is not supported in -source 1.5
  (use -source 7 or higher to enable diamond operator)
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/AppUtility.java:[87,86] diamond operator is not supported in -source 1.5
  (use -source 7 or higher to enable diamond operator)
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/ComparisionUtility.java:[58,52] diamond operator is not supported in -source 1.5
  (use -source 7 or higher to enable diamond operator)
[INFO] 3 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.266 s
[INFO] Finished at: 2017-03-01T12:11:27+05:30
[INFO] Final Memory: 13M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven: Compilation failure: Compilation failure:
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/scanUtility.java:[54,52] diamond operator is not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable diamond operator)
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/AppUtility.java:[87,86] diamond operator is not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable diamond operator)
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/ComparisionUtility.java:[58,52] diamond operator is not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable diamond operator)
[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

However, below is the build path details of the project which clearly has JRE - 8 set up: build path

and the compilation set up:

Compliance level

No matter how many times I build the project, i get the same error. Even after cleaning the project and refreshing it from eclipse doesn't help. Please guide.

UPDATE:

After adding the properties to set maven compiler plugin

<properties>
 <maven.compiler.source>1.8</maven.compiler.source>
 <maven.compiler.target>1.8</maven.compiler.target>
</properties>

,

am getting the below error:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Maven ---
[INFO] Deleting /Users/vshukla/git/Prism/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Maven ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/vshukla/git/Prism/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 66 source files to /Users/vshukla/git/Prism/target/classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java uses or overrides a deprecated API.
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: Recompile with -Xlint:deprecation for details.
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: Some input files use unchecked or unsafe operations.
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: Recompile with -Xlint:unchecked for details.
[INFO] 4 warnings 
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[26,22] package com.apple.eawt does not exist
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,41] cannot find symbol
  symbol: class Application
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,67] cannot find symbol
  symbol: variable Application
[INFO] 3 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.591 s
[INFO] Finished at: 2017-03-01T13:09:47+05:30
[INFO] Final Memory: 21M/347M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven: Compilation failure: Compilation failure:
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[26,22] package com.apple.eawt does not exist
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,41] cannot find symbol
[ERROR] symbol: class Application
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,67] cannot find symbol
[ERROR] symbol: variable Application
[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

And here is the code snippet giving the compilation error from MainUITabbed class:

    import com.apple.eawt.Application;
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    
    
                    Application application = Application.getApplication(); // line 93
                
                    ImageIcon imgicon = new ImageIcon(getClass().getResource(
                            "ICON.jpg"));
                    Image img = imgicon.getImage();
    
                    
                    application.setDockIconImage(img);
                    
                    MainUITabbed frame = new MainUITabbed();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
    
                }
            }
        });
    }
Avalon answered 1/3, 2017 at 6:56 Comment(7)
Do you have the dependency: <dependency> <groupId>com.apple</groupId> <artifactId>AppleJavaExtensions</artifactId> <version>1.4</version> </dependency> in your pom.xml?Gastronome
No. Let me try.Avalon
Brilliant. It worked. But how? Why was that error?Avalon
Because you were obviously using that library. For maven to know to add the classes in there to the classpath you have to define the dependencies accordingly.Gastronome
What is AppleJavaExtensions here?Is that your java class nameAmero
@Gastronome Chamzz.dot would like to ask you but forgot to address the question to you. Please answer to him!Bowler
@Amero In the snippet I posted above it ist the artifactId of a library provided by apple: developer.apple.com/library/archive/samplecode/…Gastronome
G
176

The error occurred because the code is not for the default compiler used there. Paste this code in effective POM before the root element ends, after declaring dependencies, to change the compiler used. Adjust version as you need.

<dependencies>
...
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
Guitarfish answered 1/3, 2017 at 7:45 Comment(4)
also please make sure that eclipse.ini file has correct JRE version which you have set as project JDKNabataean
source and target are these JDK versions?Brophy
to upgrade to 3.6+ refer to the valid versions: mvnrepository.com/artifact/org.apache.maven.plugins/…Guenevere
addings this to my pom file worked for me... but I still don't really understand why. Using java 12, I am able to do clean package on my simple project via the command line. But when I try to do the same though maven, I get the error described in this post. When you say "the code is not for the default compiler used there", are you referring to the code of maven, or code in the project itself? I similarly have set my java compiler to version 12 in eclipse, so it should be using the same java version as far as I'm aware...Prelusive
I
54

I don't think that IDE is relevant here. After all you're running a Maven and Maven doesn't have a source that will allow to compile the diamond operators. So, I think you should configure maven-compiler-plugin itself.

You can read about this here. But in general try to add the following properties:

<properties>
 <maven.compiler.source>1.8</maven.compiler.source>
 <maven.compiler.target>1.8</maven.compiler.target>
</properties>

and see whether it compiles now in Maven only.

Ingredient answered 1/3, 2017 at 7:33 Comment(2)
This works perfectly. No need of anything else to be added to fix the error.Dichlorodifluoromethane
Yeah not relevant to IDE just add compiler as you mention its work only if we add manually.Ambidexterity
S
12

If your local jdk version is 11 or 9, 10, and your project's java source/target version is 1.8, and you are using org.projectlombok:lombok package, then you can try to update its version to 1.16.22 or 1.18.12, like this:

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.22</version>
        </dependency>

It just solved my issue.

Scientism answered 10/4, 2020 at 9:43 Comment(1)
Solved my problem too. thanksBenighted
H
10

You should add the code into pom.xml like:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
Halo answered 7/9, 2018 at 5:18 Comment(1)
Solved for me. But I don't know why.Skinhead
S
7

make sure java home path is correct. for my case, java home path is wrong in pom file.

  <properties>
        <java.home>/usr/java/jdk1.8.0_45/bin/javac</java.home>
  </properties>




              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.5.1</version>
                <configuration>
                      <verbose>true</verbose>
                      <fork>true</fork>
                      <executable>${java.home}</executable>
                   <compilerVersion>1.8</compilerVersion>
                   <source>1.8</source>
                   <target>1.8</target>
                 </configuration>
             </plugin>
Spic answered 22/2, 2019 at 4:16 Comment(0)
U
7

This is an irritating error that pops up once in a while , jotting down some steps which help:

Writing answer from eclipse perspective as base logic will remain the same whether done by Intellij or command line

  1. Rt click your project -> Maven -> Update project -> Select Force update -> Click OK
  2. Under properties tag , add :
<maven.compiler.source>1.8</maven.compiler.source> 
<maven.compiler.target>1.8</maven.compiler.target>
  1. In some instances, you will start seeing error as we tried force update saying , failure to transfer X dependency from Y path , resolutions will not be reattempted , bla bla bla

    In such case quickly fix it by cd to .m2/repository folder and run following command :

for /r %i in (*.lastUpdated) do del %i
Ungraceful answered 5/11, 2019 at 8:27 Comment(2)
This cmd will do what?Greater
Yes , this command works , I had used it before putting this answer.Ungraceful
S
6

<maven.compiler.release> (not source & target)

Several of the other Answers show <maven.compiler.source> & <maven.compiler.target>. Both of these are now supplanted by the simpler single element: <maven.compiler.release>.

<maven.compiler.release>15</maven.compiler.release>

So this:

  <!--old-school-->
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>15</maven.compiler.source>
    <maven.compiler.target>15</maven.compiler.target>
  </properties>

…becomes:

  <!--modern-->
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>15</maven.compiler.release>
  </properties>

See Question, “maven.compiler.release” as an replacement for source and target?

Sandiesandifer answered 2/1, 2021 at 2:44 Comment(0)
S
5

In my case, it was caused from an incompatibility with OpenJDK 9 (which I haven't investigated).

If you don't need JDK 9, a temporary work-around would be to purge it from your machine:

sudo apt-get remove --purge openjdk-9-jdk openjdk-9-jre 
sudo apt-get remove --purge openjdk-9-jdk-headless openjdk-9-jre-headless
Selfabasement answered 4/11, 2017 at 13:28 Comment(1)
Indeed this was the issue. ThanksAlphonsa
I
5

Buddy,
If every this is up-to-date, even then you are having this problem, then
try running this command from the terminal directly instead of running from eclipse.
$ mvn clean install

and make sure these things:

  • maven is in system path
  • all maven dependencies are avaialble at `.m2/repository`
  • java is in system path


Itacolumite answered 1/12, 2017 at 10:52 Comment(0)
T
4

In case if you are able to compile mvn compile the project successful from terminal but not from Eclipse check out Window > Preferences >Installed JREs, make sure you have selected JRE that is under JDK (check out the paths of 2 different JRE's in pic), as Maven needs JDK to compile you need to add it.

Installed JREs

Tithonus answered 2/10, 2018 at 2:24 Comment(0)
A
3

I had the same problem and I Changed this

<configuration>
    <source>1.7</source>
    <target>1.7</target>
 </configuration>

here 1.7 is my JDK version.it was solved.

Amero answered 30/11, 2017 at 5:43 Comment(0)
D
3

Go to the file location where the POM is stored and open cmd. Then type "mvn --v" to check the maven version and java runtime provided. Check runtime attribute and if it is "C:\Program Files\Java\jre1.8.0_191" or even close to a JRE, go to environment variables and add a new "system variable" called "JAVA_HOME" with a value "C:\Program Files\Java\jdk1.8.0_191".

Reopen the cmd and then "clean install" the project.

Destined answered 25/10, 2018 at 6:35 Comment(0)
M
2

for it was comming because of java version mismatch ,so I have corrected it and i am able to build the war file.hope it will help someone

    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
Millenary answered 15/3, 2018 at 12:15 Comment(0)
L
2

Doing this in pom.xml file and after updating the project, the problem is gone.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>
  1. Update the pom.xml under <plugin></plugin>.

  2. Update your project.

  3. Then clean maven and install maven.

Limpkin answered 9/4, 2018 at 10:23 Comment(0)
L
2

I am not able to run my own build on the other suggestions here. I even tried different versions of maven-compiler-plugin: 3.1, 3.7.0, etc.

I made it work adding this:

<testSourceDirectory>/src/test/java</testSourceDirectory>

I tried this approach because it seems like the /src/test/java directory is considered a java class that is why it is compiled the same time as /src/test/java. So my hunch were right in my case.

Maybe it is to others too, so just try this one.

Laurence answered 10/7, 2019 at 4:58 Comment(1)
it helped me in building the swagger plugin on windows 10 successfullyWarlock
T
2

My issues was that I was running mvn compile from a child project directory instead of the parent project.

Trophy answered 19/2, 2020 at 16:12 Comment(0)
H
2

I had the same problem, the solution was set JAVA_HOME in environment variables.

Hide answered 25/8, 2020 at 12:46 Comment(0)
I
2

Worked by adding this in pom.xml:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Even you have SDK 13 or 14.

Inmost answered 11/11, 2020 at 19:52 Comment(0)
U
2

Go to: File -> Project Structure -> Project -> Switch Project SDK & Project language level to Java version 1.8

Here is example:

enter image description here

Ulcerous answered 17/5, 2021 at 12:37 Comment(0)
H
1

The below pom.xml configuration is making the build successful and make sure project buildpath JRE System library should point to Java8.

org.apache.maven.pluginsmaven-compiler-plugin3.7.0 1.81.8

Hypothyroidism answered 18/4, 2018 at 13:4 Comment(1)
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. [How do I write a good answer? ](stackoverflow.com/help/how-to-answer)Hight
B
1

Jdk 9 and 10 solution

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <debug>true</debug>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm</artifactId>
                        <version>6.2</version>
                    </dependency>
                </dependencies>
            </plugin>

and make sure your maven is pointing to JDK 10 or 9. mvn -v

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00)
Maven home: C:\devplay\apache-maven-3.5.3\bin\..
Java version: 10.0.1, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk-10.0.1
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Bornholm answered 30/7, 2018 at 20:18 Comment(0)
C
1

Add the following in your pom.xml and do CTRL+S, it will automatically build the project.

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <version>3.5.1</version> 
    <configuration>
        <source>1.8</source> 
        <target>1.8</target> 
    </configuration> 
</plugin>

Now click on Run as >Maven Test.

This error will definitely get solved.

Creation answered 13/12, 2020 at 17:14 Comment(1)
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin>Creation
S
1

Try to restart you IDE and exec mvn clean. And setting jdk full path in maven.

    <properties>
        <java.version>17</java.version>
        <JAVA_HOME>/home/jdk-17</JAVA_HOME>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                    <verbose>true</verbose>
                    <fork>true</fork>
                    <executable>${JAVA_HOME}/bin/javac</executable>
                </configuration>
            </plugin>
        </plugins>
    </build>
Safranine answered 19/9, 2022 at 4:37 Comment(0)
H
0

For me it seemed to be all the answers on this page, plus the right JDK. I added the properties:

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

and the JDK 1.8 plug-in pointing to my open JDK from Redhat:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <fork>true</fork>
        <executable>C:\java\java-1.8.0-openjdk\bin\javac.exe</executable>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>

and ran

mvn clean verify

and got build success. Yay.

Edit: I think this is actually what made the difference: https://mkyong.com/eclipse/eclipse-ide-no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-rather-than-a-jdk/

Haphazardly answered 16/8, 2021 at 18:27 Comment(0)
C
0

In my case, I set the JAVA_HOME correctly but still had problem for hours! Finally I found out that I had settings.xml in .m2 directory and the java home was set there and pointed to another path. I ran the following command to find out what java path the maven is using:

mvn clean install -X | grep -i "executable"

Then I corrected the java home path in the settings.xml in .m2 directory and problem solved!

Colp answered 17/8, 2021 at 22:20 Comment(0)
I
0

Note: if you have your project under File->Project Structure setup for one specific version of Java and you have your Pom.xml setup for a different version of Java, you will get this error. For example, running Java 8 under Project Structure and Java 11 in your pom.xml.

Impute answered 5/1, 2022 at 16:1 Comment(0)
F
0

I have tried to solve it manually many times, but every time error occurs in maven.

Last I left it to maven to solve this,

First use Maven clean,

Right-click on project -> Run as -> Maven Clean

Second use Maven Install,

Right-click on project -> Run as -> Maven Install

Third use Maven Update,

Right-click on project -> Maven -> Update Project
Footpad answered 7/6, 2022 at 18:21 Comment(0)
C
0

For Java 11 this plugin should work.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>
    <configuration>
        <release>11</release>
    </configuration>
</plugin>
Coracorabel answered 19/6, 2022 at 23:30 Comment(0)
L
0

In my case, it was because I had set the <packaging> to war instead of jar in my pom.xml while using javafx.

<packaging>jar</packaging>
Lorient answered 1/8, 2022 at 18:57 Comment(0)
E
0

That was really painful 2 hours...

Here's what worked for me (while creating a new project):

  • Check what Java version you've got installed (I've used Java 11. Older versions may not be compatible with some Maven versions)
  • Environment variables - check if you've got proper Java version applied
  • Use https://start.spring.io/, instead of IntelliJ's initializator
  • Name your project in "Artifact" field. Do not use any uppercase letters. Do not rename any other fields spring.io
  • Do not rename a directory name of unpacked .zip file
  • IntelliJ: Ctrl+Alt+S and check if you are using proper Java version
  • If any changes applied -> Reload Maven -> Clean -> Install
Excellent answered 16/12, 2022 at 21:41 Comment(0)
O
0

Try upgrade your version of Maven, that's what fixed this for me.

export M2_HOME=/.../java/Maven/apache-maven-3.9.0
echo | mvn -v

Older versions of mvn don't work with later versions of java

Omasum answered 8/3, 2023 at 7:31 Comment(0)
H
0

I solved with adding this to the active profile in settings.xml

<properties>
   <JAVA_1_8_HOME>c:\Program Files\Java\jdk-1.8\</JAVA_1_8_HOME>
</properties>
Hamfurd answered 12/6, 2023 at 13:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.