问题描述
- maven compile遇到的问题
-
我按照maven文件的约定结构写了一个Hello world,但是在运行mvn compile命令的时候出现了问题,求大神解答: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:codemaven01>mvn compile [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-parseable POM E:codemaven01pom.xml: only whitespace content allowed before start tag and not u3001 (position: START_DOCUMENT seen <?xml version="1.0" encoding="UTF-8"?> u3001... @2:2) @ line 2, column 2 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project (E:codemaven01pom.xml) has 1 error [ERROR] Non-parseable POM E:codemaven01pom.xml: only whitespace content allowed before start tag and not u3001 (position: START_DOCUMENT seen <?xml version="1.0" encoding="UTF-8"?> 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
解决方案
maven deploy 遇到的问题
使用Maven遇到的问题
使用Maven遇到的问题整理
解决方案二:
你pom.xml格式不正确,utf8字符串后面怎么多了一个顿号。'、'
时间: 2024-09-23 22:13:20