最后,配置idea,运行Junit test。idea右上角,点击下拉框,选择Edit configuration -> "+" ->Maven 配置Working directory为代码目录; command line中填入:clean complile test,表示让执行mvn clean&compile&test。保存配置。点击绿色三角号,运行test,在底部的输出栏内可看到如下内容:
D:\study\maven\01>mvn test [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building hello-first 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-firs t --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e . build is platform dependent! [INFO] skip non existing resourceDirectory D:\study\maven\01\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ hello-first - -- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ he llo-first --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e . build is platform dependent! [INFO] skip non existing resourceDirectory D:\study\maven\01\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ hello -first --- [WARNING] File encoding has not been set, using platform encoding GBK, i.e. buil d is platform dependent! [INFO] Compiling 1 source file to D:\study\maven\01\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello-first --- [INFO] Surefire report directory: D:\study\maven\01\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running test.TestHello.TestHello Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.151 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.346s [INFO] Finished at: Wed Oct 02 18:23:23 CST 2013 [INFO] Final Memory: 9M/22M [INFO] ------------------------------------------------------------------------ D:\study\maven\01> |