maven compile遇到的问题

我按照maven文件的约定结构写了一个Hello world,但是在运行mvn compile命令的时候出现了问题,求大神解答:

文件结构
HelloWorld.java

 package cn.ac.imicams.maven01.model;

public class HelloWorld{
    public String sayHello(){
        return "Hello World!";
    }
}

HelloWorldTest.java

 package cn.ac.imicams.maven01.model;

import org.junit.*;
import org.junit.Assert.*;

public class HelloWorldTest{
    @Test
    public void testHello(){
        Assert.assertEquals("Hello World!", new HelloWorld().sayHello());
    }
}

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

  <groupID>cn.ac.imicams.maven01</groupID>
  <artifactID>maven01-model</artifactID>
  <version>0.0.1SNAPSHOT</version>

  <dependencies>
    <dependency>
        <groupID>junit</groupID>
        <artifactID>junit</artifactID>
        <version>4.10</version>
    </dependency>
  </dependencies>
</project>

错误代码如下:

 E:\code\maven01>mvn compile
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM E:\code\maven01\pom.xml: only whitespace content allowed before start tag and not \u3001 (position: START_DOCUMENT seen <?xml version="1.0" encoding="UTF-8"?>\n\u3001... @2:2)  @ line 2, column 2
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project  (E:\code\maven01\pom.xml) has 1 error
[ERROR]     Non-parseable POM E:\code\maven01\pom.xml: only whitespace content allowed before start tag and not \u3001 (position: START_DOCUMENT seen <?xml version="1.0" encoding="UTF-8"?>\n\u3001... @2:2)  @ line 2, column 2 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException

查看全部
u013624467
zelda-zhang
2015/08/03 15:59
  • maven
  • 点赞
  • 收藏
  • 回答
    私信

2个回复