亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

mvn test報錯,有人能看下嗎?

https://img1.sycdn.imooc.com//5bc8b49600013c2611070523.jpg

F:\xiangmu3\Xin\FuQiang\maven\code\maven01>mvn test

[INFO] Scanning for projects...

[WARNING]

[WARNING] Some problems were encountered while building the effective model for com.ddwei.maven01:maven01-model:jar:0.0.1SNAPSHOT

[WARNING] 'version' uses an unsupported snapshot version format, should be '*-SNAPSHOT' instead. @ line 10, column 12

[WARNING]

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

[WARNING]

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

[WARNING]

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building maven01-model 0.0.1SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven01-model ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] skip non existing resourceDirectory F:\xiangmu3\Xin\FuQiang\maven\code\maven01\src\main\resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven01-model ---

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven01-model ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] skip non existing resourceDirectory F:\xiangmu3\Xin\FuQiang\maven\code\maven01\src\test\resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven01-model ---

[INFO] Changes detected - recompiling the module!

[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!

[INFO] Compiling 1 source file to F:\xiangmu3\Xin\FuQiang\maven\code\maven01\target\test-classes

[INFO] -------------------------------------------------------------

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[3,1] 程序 包org.junit不存在

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[4,1] 程序 包org.junit.Assert不存在

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[8,10] 找不到符號

? 符號:? ?類 Test

? 位置: 類 com.ddwei.entity.model.TestHelloWorld

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[10,25] 找 不到符號

? 符號:? ?變量 Assert

? 位置: 類 com.ddwei.entity.model.TestHelloWorld

[INFO] 4 errors

[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1.866 s

[INFO] Finished at: 2018-10-19T00:20:53+08:00

[INFO] Final Memory: 11M/150M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project maven01-model: Compilation failure: Compilation failure:

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[3,1] 程序 包org.junit不存在

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[4,1] 程序 包org.junit.Assert不存在

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[8,10] 找不到符號

[ERROR] 符號:? ?類 Test

[ERROR] 位置: 類 com.ddwei.entity.model.TestHelloWorld

[ERROR] /F:/xiangmu3/Xin/FuQiang/maven/code/maven01/src/test/java/com/ddwei/entity/model/TestHelloWorld.java:[10,25] 找 不到符號

[ERROR] 符號:? ?變量 Assert

[ERROR] 位置: 類 com.ddwei.entity.model.TestHelloWorld

[ERROR] -> [Help 1]

[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/MojoFailureException


F:\xiangmu3\Xin\FuQiang\maven\code\maven01>


正在回答

4 回答

<dependencies>
????<dependency>
????????<groupId>junit</groupId>
????????<artifactId>junit</artifactId>
????????<version>4.10</version>
????</dependency>
</dependencies>

看看pom.xml中的配置,如果寫成下面的,就會報junit不存在的錯誤

<modelVersion>4.0.0</modelVersion>


0 回復 有任何疑惑可以回復我~

package com.ddwei.entity.model;


import org.junit.*;

import org.junit.Assert.*;


public class TestHelloWorld{

@Test

public void sayHello(){

Assert.assertEquals("Hello World!",new HelloWorld().sayHello());

}



}


0 回復 有任何疑惑可以回復我~

語法已經檢查,是junit包當不下來

0 回復 有任何疑惑可以回復我~

查看TestHelloWorld.java 這個文件,https://img1.sycdn.imooc.com//5bcb2e840001759e12220344.jpg這幾行都出錯了。好好檢查下語法

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
項目管理利器——maven
  • 參與學習       173023    人
  • 解答問題       789    個

使用maven來構建和管理Java項目,從環境配置,到maven核心知識

進入課程

mvn test報錯,有人能看下嗎?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號