zelda-zhang 2015-08-03 15:59 采纳率: 0%
浏览 12404

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

  • 写回答

3条回答 默认 最新

  • oyljerry 2015-08-03 23:43
    关注

    你pom.xml格式不正确,utf8字符串后面怎么多了一个顿号。'、'

    评论

报告相同问题?

悬赏问题

  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致