新增的類用到gson-1.7.2.jar包,因此編譯報錯,之前也引入了該jar包,僅僅是用於測試階段而已。java
解決辦法:apache
去掉<scope>test</scope>便可maven
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.7.2</version>
<scope>test</scope>
</dependency>測試
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.510s
[INFO] Finished at: Mon Aug 13 11:06:57 CST 2018
[INFO] Final Memory: 39M/394M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project performance: Compilation failure
[ERROR] /D:/workPath/infinitus/performance/src/main/java/com/infinitus/it/performance/controller/MsgController.java:[20,23] 程序包com.google.gson不存在
[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
google