The new class uses gson-1.7.2.jar package, so the compilation reports an error, and the jar package was introduced before, just for the testing phase.
Workaround.
Just remove <scope>test</scope>
<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] Program package com.google.gson does not exist
[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
Similar Posts:
- [Solved] Jsonobject has no from object, idea has no Maven dependency, jsonobject Maven dependency package
- Maven no main manifest attribute when generate jar for project
- How to Solve compile error: package junit.framework does not exist
- Unregistering JMX-exposed beans on shutdown Solution
- [Solved] SparkSQL Error: org.apache.hadoop.security.HadoopKerberosName.setRuleMechanism
- Springboot always reports an error when importing JSP dependencies
- Compilation failure cannot find the class file for org.apache.http.annotation.notthreadsafe
- Maven warnning: ‘build.plugins.plugin.version’ is missing [How to Solve]
- Maven does not have a servlet (an error is reported after the servlet is created)
- Could not transfer artifact org.glassfish:javax.el:pom:3.0.1-b06-SNAPSHOT from/to jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots)