maven工程打包出现Test相关的错误

时间:2023-03-08 15:37:42
  1. -----------------------------------------------------
  2. T E S T S
  3. -------------------------------------------------------
  4. -------------------------------------------------------
  5. T E S T S
  6. -------------------------------------------------------
  7. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  8. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  9. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  10. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  11. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  12. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  13. Running com.soso.baike.audit.log.MainTest
  14. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec
  15. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  16. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  17. Running com.soso.baike.domain.LevelTest
  18. Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec
  19. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  20. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  21. Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=10, useUnlimitedThreads=false
  22. Running com.soso.baike.fs.LemmaFsGetCmdTest
  23. Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
  24. Running com.soso.baike.domain.AuditInfoTest
  25. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.142 sec
  26. SLF4J: Class path contains multiple SLF4J bindings.
  27. SLF4J: Found binding in [jar:file:/D:/code/.m2/repository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  28. SLF4J: Found binding in [jar:file:/D:/code/.m2/repository/com/wenwen/log/slf4j/1.0.0-SNAPSHOT/slf4j-1.0.0-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  29. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  30. log4j:ERROR Could not find value for key log4j.appender.noerrorLog
  31. log4j:ERROR Could not instantiate appender named "noerrorLog".
  32. log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.
  33. log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.
  34. Running com.soso.baike.dao.db.level.IbatisLevelDaoTest
  35. Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.681 sec <<< FAILURE!
  36. testGet(com.soso.baike.dao.db.level.IbatisLevelDaoTest)  Time elapsed: 0.001 sec  <<< ERROR!
  37. java.lang.NullPointerException
  38. at com.soso.baike.dao.db.level.IbatisLevelDaoTest.testGet(IbatisLevelDaoTest.java:23)
  39. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  40. at java.lang.reflect.Method.invoke(Method.java:606)
  41. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  42. at java.lang.reflect.Method.invoke(Method.java:606)
  43. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  44. at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  45. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  46. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  47. at java.lang.Thread.run(Thread.java:745)

这是用idea右侧的maven Projects下的package功能打包maven工程时候出现的错误

解决办法:不用上述方式编译打包,改用命令行方式跳过Test,命令如下:

mvn clean package -DskipTests

这样maven就不会进行Test相关的编译了。