Unable to change Maven version in Eclipse IDE

After rejecting the mvn package inside Eclipse, but after the terminal shutdown, I realized that Eclipse was running Maven 3.3.3 , while the terminal was running 3.3.9 . I tried and, by all accounts, managed to reconfigure the eclipse by going to Eclipse -> Preferences -> Maven -> Installations and pointing to my folder 3.3.9 . I restarted Eclipse and tried again, but was not available. In addition, when you try to build, changes to the pom.xml file pom.xml not confirmed. I have inserted inappropriate slashes and other characters and can only generate this error:

WAR build error: web.xml attribute required (or existing WEB-INF / web.xml when running in update mode)

I modified my pom file according to this recommendation, but, as I said, maven does not recognize the changes in pom, and I cannot run mvn --version to create 3.3.9 , as you would expect. I attached my pom.xml below

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.javawebtutor</groupId> <artifactId>LoginWebApp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>LoginWebApp Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.30</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> </dependency> </dependencies> <build> <finalName>LoginWebApp</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webXml>src\main\webapp\WEB-INF\web.xml</webXml> </configuration> </plugin> </plugins> </build> 

+5
source share
3 answers

Try configuring the configuration at runtime or see if you are already using it.

In eclipse, right click on projects -> run as-> run configurations. Locate the m2 Maven Build section on the left. If there is a name under the name of your project, edit it, otherwise create it. At the bottom of the dialog box there is a drop-down list that allows you to select the maven configuration that you want to run:

enter image description here

This gives me the following result:

 Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11 10T11:41:47-05:00) Maven home: C:\Program Files\Java\apache-maven-3.3.9 Java version: 1.7.0_80, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.7.0_80\jre Default locale: en_US, platform encoding: UTF-8 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows" 
+7
source
  • Call cmd , enter systempropertiesadvanced Check the environment variables: %MAVEN_HOME% , %PATH% .
  • Check the following steps: enter image description here



See the screenshot below (this applies to your problem):

EMBEDDED: 3.3.3
outsite Eclipse: 3.3.9

enter image description here

enter image description here

enter image description here

enter image description here

(source: http://codingvn.com/2016/02/08/cau-hinh-de-eclipse-su-dung-ban-cai-dat-maven-ben-ngoai-ide/ this is my site)

+4
source

Usually you need to reinstall the m2eclipse plugin to run with the correct version. If it has been updated, it will not work with the previous one, as it will accept the "old" version of maven.

0
source

Source: https://habr.com/ru/post/1243480/


All Articles