简体   繁体   English

如何创建简单的Maven Java Web项目

[英]How to create simple maven java web project

I spend more than a half day to figure out how to do simple maven project. 我花了半天多的时间弄清楚如何做简单的Maven项目。 Eclipse seems weird IDE throwing all errors. Eclipse似乎怪异的IDE抛出了所有错误。

Steps I did: 1, Installed Eclipse 2, Maven home & java home and path set environment variable 3, Create a simple maven project 我执行的步骤:1,安装了Eclipse 2,安装了Maven主页和Java主页以及路径设置环境变量3,创建了一个简单的maven项目

pom.xml has error first line [![enter image description here][2]][2] pom.xml第一行有错误[![在此处输入图片描述] [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. 从教程和视频中,我已经提到在创建新的Maven项目时,它具有Java资源文件夹,其中也提到了版本。

I am using eclipse photon and maven 3.5.4 我正在使用蚀光子和Maven 3.5.4

Error dialog : Probel occured 'Building workspace encountered problem' 'Errors occured during build' 错误对话框:发生Probel'遇到建筑工作区问题''在构建期间发生错误'

Error Dialog description: 错误对话框说明:

Errors running builder 'Maven Project Builder' on project 'TestApp'. 在项目“ TestApp”上运行构建器“ Maven Project Builder”时出错。 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 无法计算构建计划:插件org.apache.maven.plugins:maven-resources-plugin:2.6或其依赖项之一无法解析:无法读取org.apache.maven.plugins:maven-resources-的工件描述符插件:罐子:2.6

pom.xml contents: pom.xml内容:

<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. 这是您所需的最低限度的pom.xml内容。 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. 您只需构建一个简单的基本Maven项目,就不需要更多。 I think closing tag </project> is missing the the code you posted 我认为结束标记</project>缺少您发布的代码

 <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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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