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 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?