eclipse Maven pom.xml 问题(缺少项目构建错误“版本”)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32329583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven pom.xml Problems (Project Build Error "version" is missing)
提问by user3839833
So the top part of my pom.xml
looks like this:
所以我的顶部pom.xml
看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<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</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>0.0.2-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
However, at the first line I get the errors:
但是,在第一行我收到错误:
Project Build Error: version is missing
项目构建错误:缺少版本
followed by the same phrase with artifactid
, groupid
and model version
. I have no idea how to solve the problem, a friend of mine suggested setting the JAVA_HOME
system variable which I did and set it to my JDK Path. Nothing changed though. Anything else I could try to solve this problem? I've also heard something considering the system variables and java.home but I did not really understand the difference and how to solve my problem with it.
后跟带有artifactid
,groupid
和的相同短语model version
。我不知道如何解决这个问题,我的一个朋友建议设置JAVA_HOME
我所做的系统变量并将其设置为我的 JDK 路径。然而什么都没有改变。还有什么我可以尝试解决这个问题的吗?我也听说过一些考虑系统变量和 java.home 的东西,但我并没有真正理解它们之间的区别以及如何解决我的问题。
Edit: Here is the complete pom:
编辑:这是完整的pom:
<?xml version="1.0" encoding="UTF-8"?>
<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</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>0.0.2-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>${gwtVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.gwtupload</groupId>
<artifactId>gwtupload</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>de.novanic.gwteventservice</groupId>
<artifactId>gwteventservice</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes"
update them in DevMode -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>test.html</runTarget>
<modules>
<module>com.test.test</module>
</modules>
<copyWebapp>true</copyWebapp>
<sourceLevel>1.7</sourceLevel>
</configuration>
</plugin>
</plugins>
</build>
This is the output of mvn package -X:
这是 mvn package -X 的输出:
(Stackoverflow seems to only format it for a few lines and I always have to add four spaces again, I'm using the feature wrong I guess)
(Stackoverflow 似乎只将它格式化为几行,我总是不得不再次添加四个空格,我猜我使用的功能是错误的)
回答by Myzreal
This seems like an error with the file structure. Your complete POM is pasted wrong so I can't really check it, perhaps you are not opening and closing the tag properly?
这似乎是文件结构的错误。您的完整 POM 粘贴错误,所以我无法真正检查它,也许您没有正确打开和关闭标签?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="..." (...)>
...
</project>
EDIT: The POM is pasted properly now, indeed you have no project closing tag at the end.
编辑:POM 现在已正确粘贴,实际上您最后没有项目结束标记。