I\'ve never worked with Maven before and I am following the instructions here. When I run the command
mvn integration-test -Pamp-to-war
It
I had the same error and I was missing the User variable: JAVA_HOME and the value for the SDK - "C:\Program Files\Java\jdk-9.0.1" in my case
Add this configurations in pom.xml
<project ...>
...
<build>
...
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.7.0_79\bin\javac</executable>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
i am using centos
and getting same error when run mvn
command with goal, install
. After some googling i have found the solution to run following command.
sudo yum install java-1.8.0-openjdk-devel
Right click on your project folder (Maven one), select properties and from the properties window, again select Java Compiler and see what is selected against compiler compliance level and make sure that it is the same version as your jre. In my case I had 1.8 but 1.5 was selected against compiler compliance level. After selecting 1.8 the build was successful without this error.
I was facing the same issue in eclipse maven project, all i did was
right click on the project
maven --> update project
or just press ALT+ F5
If the above solutions doesn't work then try to place java path before maven in path of environment variable. It worked for me.
%JAVA_HOME%\bin
C:\Program Files\apache-maven-3.6.1-bin\apache-maven-3.6.1\bin