错误情况
maven工程时,一直提示junit错误,仔细查看,发现有junit包,但是仍然没起作用,pom.xml加上了版本信息,还是不行,感觉为包错误,浏览包类,打开提示 “invalid LOC header (bad signature)” ,感觉下载的junit包出问题。
解决手段
删除本地repository 中junit 包,重新run install,更新工程,无错误。
[INFO] Scanning for projects... [INFO] [INFO] -------------------< com.iluwatar:abstract-factory >-------------------- [INFO] Building abstract-factory 1.18.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-checkstyle-plugin:2.17:check (validate) @ abstract-factory --- [INFO] Starting audit... Audit done. [INFO] [INFO] --- jacoco-maven-plugin:0.7.2.201409121644:prepare-agent (prepare-agent) @ abstract-factory --- [INFO] argLine set to -javaagent:D:\\maven\\repository\\org\\jacoco\\org.jacoco.agent\\0.7.2.201409121644\\org.jacoco.agent-0.7.2.201409121644-runtime.jar=destfile=C:\\Users\\livingbody\\Desktop\\pdf\\java-design-patterns\\abstract-factory\\target\\jacoco.exec [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ abstract-factory --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\livingbody\Desktop\pdf\java-design-patterns\abstract-factory\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ abstract-factory --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- urm-maven-plugin:1.4.4:map (default) @ abstract-factory --- [INFO] Skip configured (in pom.xml) for current project "abstract-factory". Plugin will not be executed! [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ abstract-factory --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\livingbody\Desktop\pdf\java-design-patterns\abstract-factory\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ abstract-factory --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ abstract-factory --- [INFO] Surefire report directory: C:\Users\livingbody\Desktop\pdf\java-design-patterns\abstract-factory\target\surefire-reports [INFO] Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider [INFO] parallel='none', perCoreThreadCount=true, threadCount=0, useUnlimitedThreads=false, threadCountSuites=0, threadCountClasses=0, threadCountMethods=0, parallelOptimized=true ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.iluwatar.abstractfactory.AbstractFactoryTest Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in com.iluwatar.abstractfactory.AbstractFactoryTest Running com.iluwatar.abstractfactory.AppTest 17:30:29.629 [main] INFO com.iluwatar.abstractfactory.App - Elf Kingdom 17:30:29.653 [main] INFO com.iluwatar.abstractfactory.App - This is the Elven Army! 17:30:29.653 [main] INFO com.iluwatar.abstractfactory.App - This is the Elven castle! 17:30:29.654 [main] INFO com.iluwatar.abstractfactory.App - This is the Elven king! 17:30:29.654 [main] INFO com.iluwatar.abstractfactory.App - Orc Kingdom 17:30:29.654 [main] INFO com.iluwatar.abstractfactory.App - This is the Orc Army! 17:30:29.654 [main] INFO com.iluwatar.abstractfactory.App - This is the Orc castle! 17:30:29.654 [main] INFO com.iluwatar.abstractfactory.App - This is the Orc king! Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in com.iluwatar.abstractfactory.AppTest Results : Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ abstract-factory --- [INFO] Building jar: C:\Users\livingbody\Desktop\pdf\java-design-patterns\abstract-factory\target\abstract-factory-1.18.0-SNAPSHOT.jar [INFO] [INFO] >>> maven-pmd-plugin:3.6:check (default) > :pmd @ abstract-factory >>> [INFO] [INFO] --- maven-pmd-plugin:3.6:pmd (pmd) @ abstract-factory --- [WARNING] Unable to locate Source XRef to link to - DISABLED [INFO] [INFO] <<< maven-pmd-plugin:3.6:check (default) < :pmd @ abstract-factory <<< [INFO] [INFO] [INFO] --- maven-pmd-plugin:3.6:check (default) @ abstract-factory --- [INFO] [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ abstract-factory --- [INFO] Installing C:\Users\livingbody\Desktop\pdf\java-design-patterns\abstract-factory\target\abstract-factory-1.18.0-SNAPSHOT.jar to D:\maven\repository\com\iluwatar\abstract-factory\1.18.0-SNAPSHOT\abstract-factory-1.18.0-SNAPSHOT.jar [INFO] Installing C:\Users\livingbody\Desktop\pdf\java-design-patterns\abstract-factory\pom.xml to D:\maven\repository\com\iluwatar\abstract-factory\1.18.0-SNAPSHOT\abstract-factory-1.18.0-SNAPSHOT.pom [INFO] [INFO] --- license-maven-plugin:2.11:format (install-format) @ abstract-factory --- [INFO] Updating license headers... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8.053 s [INFO] Finished at: 2018-12-12T17:30:31+08:00 [INFO] ------------------------------------------------------------------------