maven-compiler-plugin:3.7.0:Spring工具套件中的compile(default-compile)

时间:2018-04-05 16:42:07

标签: java spring maven maven-plugin spring-tool-suite

I have added the plugin in pom.xml as shown in snap for jdk1.8 and maven-compiler-plugin version 3.7.0

当我通过右键单击项目名称进行maven安装时出现以下错误:

    [INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.userlogin.example:SpringMvcUser:war:0.1
[WARNING] 'dependencies.dependency.systemPath' for com.github.noraui:ojdbc8:jar should not point at files within the project directory, ${project.basedir}\lib\ojdbc8.jar will be unresolvable by dependent projects @ line 82, column 16
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringMvcUser Maven Webapp 0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SpringMvcUser ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ SpringMvcUser ---
[INFO] Compiling 7 source files to F:\workspace-sts-3.9.2.RELEASE\SpringMvcUser\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] error reading C:\Users\Chandan\.m2\repository\javax\servlet\javax.servlet-api\3.0.1\javax.servlet-api-3.0.1.jar; invalid CEN header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-core\4.3.2.RELEASE\spring-core-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-beans\4.3.2.RELEASE\spring-beans-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-context\4.3.2.RELEASE\spring-context-4.3.2.RELEASE.jar; invalid CEN header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-aop\4.3.2.RELEASE\spring-aop-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-expression\4.3.2.RELEASE\spring-expression-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-jdbc\4.3.2.RELEASE\spring-jdbc-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-tx\4.3.2.RELEASE\spring-tx-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/RegistrationController.java:[12,29] package jbr.springmvc.service does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/RegistrationController.java:[17,16] cannot find symbol
  symbol:   class UserService
  location: class com.userlogin.controller.RegistrationController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[11,27] package jbr.springmvc.model does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[12,27] package jbr.springmvc.model does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[13,29] package jbr.springmvc.service does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[18,9] cannot find symbol
  symbol:   class UserService
  location: class com.userlogin.controller.LoginController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[29,50] cannot find symbol
  symbol:   class Login
  location: class com.userlogin.controller.LoginController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[23,44] cannot find symbol
  symbol:   class Login
  location: class com.userlogin.controller.LoginController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[31,17] cannot find symbol
  symbol:   class User
  location: class com.userlogin.controller.LoginController
[INFO] 17 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.794 s
[INFO] Finished at: 2018-04-05T21:29:15+05:30
[INFO] Final Memory: 15M/179M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project SpringMvcUser: Compilation failure: Compilation failure:
[ERROR] error reading C:\Users\Chandan\.m2\repository\javax\servlet\javax.servlet-api\3.0.1\javax.servlet-api-3.0.1.jar; invalid CEN header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-core\4.3.2.RELEASE\spring-core-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-beans\4.3.2.RELEASE\spring-beans-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-context\4.3.2.RELEASE\spring-context-4.3.2.RELEASE.jar; invalid CEN header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-aop\4.3.2.RELEASE\spring-aop-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-expression\4.3.2.RELEASE\spring-expression-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-jdbc\4.3.2.RELEASE\spring-jdbc-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\Chandan\.m2\repository\org\springframework\spring-tx\4.3.2.RELEASE\spring-tx-4.3.2.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/RegistrationController.java:[12,29] package jbr.springmvc.service does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/RegistrationController.java:[17,16] cannot find symbol
[ERROR] symbol:   class UserService
[ERROR] location: class com.userlogin.controller.RegistrationController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[11,27] package jbr.springmvc.model does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[12,27] package jbr.springmvc.model does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[13,29] package jbr.springmvc.service does not exist
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[18,9] cannot find symbol
[ERROR] symbol:   class UserService
[ERROR] location: class com.userlogin.controller.LoginController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[29,50] cannot find symbol
[ERROR] symbol:   class Login
[ERROR] location: class com.userlogin.controller.LoginController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[23,44] cannot find symbol
[ERROR] symbol:   class Login
[ERROR] location: class com.userlogin.controller.LoginController
[ERROR] /F:/workspace-sts-3.9.2.RELEASE/SpringMvcUser/src/main/java/com/userlogin/controller/LoginController.java:[31,17] cannot find symbol
[ERROR] symbol:   class User
[ERROR] location: class com.userlogin.controller.LoginController
[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

我已尝试过链接Maven compiler plugin always detecting a set of sources as "stale"

http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException  还有许多其他的链接,但我没有从上面的链接获得任何解决方案仍然收到错误,请帮助解决这个问题

2 个答案:

答案 0 :(得分:2)

看起来本地Maven存储库中的JAR文件已损坏。擦除本地Maven仓库(〜/ .m2 / repository)并从命令行运行干净的构建。这应该可以解决问题。

答案 1 :(得分:0)

检查pom.xml中提到的Java版本和JAVA_HOME中指向的Java版本。两者都应该相同。

如果您在STS中运行该命令。将已安装的JRE设置为pom.xml中提到的Java Version的JDK Home路径