简体   繁体   中英

How to create simple maven java web project

I spend more than a half day to figure out how to do simple maven project. Eclipse seems weird IDE throwing all errors.

Steps I did: 1, Installed Eclipse 2, Maven home & java home and path set environment variable 3, Create a simple maven project

pom.xml has error first line [![enter image description here][2]][2]

<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/xsd/maven-4.0.0.xsd">

From tutorials and videos i've referred it has java resource folder with version mentioned also there when creating new maven project.

I am using eclipse photon and maven 3.5.4

Error dialog : Probel occured 'Building workspace encountered problem' 'Errors occured during build'

Error Dialog description:

Errors running builder 'Maven Project Builder' on project 'TestApp'. Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

pom.xml contents:

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.gps</groupId>
  <artifactId>TestApp</artifactId>
  <version>0.0.1-SNAPSHOT</version>

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.gps</groupId>
  <artifactId>TestApp</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>

This is the very minimum pom.xml content you need. If you have this then the something else should be the problem. You don't need more than this to build a simple basic maven project. I think closing tag </project> is missing the the code you posted

 <h4>Error was thrown Because it was unable to download any artifacts or resources from repo. Reason was i was behind the proxy i needed to configure in settings.xml <br/> Located in <br/> pref-> maven -> user settings<br/> After i configured everything working fine<br/> </h4> <xmp> <proxy> <active>true</active> <protocol>http</protocol> <host>proxy.somewhere.com</host> <port>80</port> </proxy> </xmp> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM