当前位置: 首页 > 知识库问答 >
问题:

我在一个Spring项目中使用Lombok,但是Maven构建失败了

高修筠
2023-03-14
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>2.0.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <!-- scope>test</scope-->
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>1.10.19</version>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <scope>test</scope>
            <version>2.44.0</version>
        </dependency>
        <dependency>
            <groupId>com.opera</groupId>
            <artifactId>operadriver</artifactId>
            <scope>test</scope>
            <version>1.5</version>
            <exclusions>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-remote-driver</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.codehaus.sonar-plugins.java/sonar-jacoco-listeners -->
        <dependency>
            <groupId>org.codehaus.sonar-plugins.java</groupId>
            <artifactId>sonar-jacoco-listeners</artifactId>
            <version>3.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.mail/mail -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test-autoconfigure</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.20</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building project-management 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ project-management ---
[INFO] Deleting /Users/domingosmartins/git/switch-2017-g003/target
[INFO] 
[INFO] --- jacoco-maven-plugin:0.7.9:prepare-agent (default-prepare-agent) @ project-management ---
[INFO] argLine set to -javaagent:/Users/domingosmartins/.m2/repository/org/jacoco/org.jacoco.agent/0.7.9/org.jacoco.agent-0.7.9-runtime.jar=destfile=/Users/domingosmartins/git/switch-2017-g003/target/jacoco.exec
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ project-management ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ project-management ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 138 source files to /Users/domingosmartins/git/switch-2017-g003/target/classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] No processor claimed any of these annotations: org.springframework.web.bind.annotation.PathVariable,org.springframework.beans.factory.annotation.Autowired,org.springframework.web.bind.annotation.RequestMapping,org.springframework.stereotype.Controller,org.springframework.web.bind.annotation.RequestBody,javax.persistence.Table,org.springframework.stereotype.Service,com.fasterxml.jackson.annotation.JsonIgnore,javax.persistence.Enumerated,org.springframework.web.bind.annotation.ExceptionHandler,org.springframework.stereotype.Repository,javax.persistence.ManyToMany,javax.persistence.Id,org.springframework.web.bind.annotation.ControllerAdvice,javax.persistence.Entity,javax.persistence.ManyToOne,com.fasterxml.jackson.annotation.JsonBackReference,org.springframework.boot.autoconfigure.SpringBootApplication,javax.transaction.Transactional,javax.persistence.JoinColumn,javax.persistence.OneToMany,org.springframework.web.bind.annotation.RestController,javax.persistence.OneToOne,javax.persistence.Column,org.springframework.stereotype.Component,javax.persistence.GeneratedValue,javax.persistence.Transient,javax.annotation.PostConstruct,org.springframework.web.bind.annotation.RequestHeader,com.fasterxml.jackson.annotation.JsonManagedReference
[INFO] 1 warning
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] warnings found and -Werror specified
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.878 s
[INFO] Finished at: 2018-04-10T15:16:57+01:00
[INFO] Final Memory: 36M/294M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project project-management: Compilation failure
[ERROR] warnings found and -Werror specified
[ERROR] 
[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
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building project-management 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ project-management ---
[INFO] Deleting /Users/domingosmartins/git/switch-2017-g003/target
[INFO] 
[INFO] --- jacoco-maven-plugin:0.7.9:prepare-agent (default-prepare-agent) @ project-management ---
[INFO] argLine set to -javaagent:/Users/domingosmartins/.m2/repository/org/jacoco/org.jacoco.agent/0.7.9/org.jacoco.agent-0.7.9-runtime.jar=destfile=/Users/domingosmartins/git/switch-2017-g003/target/jacoco.exec
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ project-management ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ project-management ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 138 source files to /Users/domingosmartins/git/switch-2017-g003/target/classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] No processor claimed any of these annotations: org.springframework.web.bind.annotation.PathVariable,org.springframework.beans.factory.annotation.Autowired,org.springframework.web.bind.annotation.RequestMapping,org.springframework.stereotype.Controller,org.springframework.web.bind.annotation.RequestBody,javax.persistence.Table,org.springframework.stereotype.Service,com.fasterxml.jackson.annotation.JsonIgnore,javax.persistence.Enumerated,org.springframework.web.bind.annotation.ExceptionHandler,org.springframework.stereotype.Repository,javax.persistence.ManyToMany,javax.persistence.Id,org.springframework.web.bind.annotation.ControllerAdvice,javax.persistence.Entity,javax.persistence.ManyToOne,com.fasterxml.jackson.annotation.JsonBackReference,org.springframework.boot.autoconfigure.SpringBootApplication,javax.transaction.Transactional,javax.persistence.JoinColumn,javax.persistence.OneToMany,org.springframework.web.bind.annotation.RestController,javax.persistence.OneToOne,javax.persistence.Column,org.springframework.stereotype.Component,javax.persistence.GeneratedValue,javax.persistence.Transient,javax.annotation.PostConstruct,org.springframework.web.bind.annotation.RequestHeader,com.fasterxml.jackson.annotation.JsonManagedReference
[INFO] 1 warning
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] warnings found and -Werror specified
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.603 s
[INFO] Finished at: 2018-04-12T01:06:27+01:00
[INFO] Final Memory: 36M/288M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project project-management: Compilation failure
[ERROR] warnings found and -Werror specified
[ERROR] 
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project project-management: Compilation failure
warnings found and -Werror specified

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
warnings found and -Werror specified

    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1161)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:168)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] 
[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

共有1个答案

慕宏博
2023-03-14

仔细看这一行

[WARNING] No processor claimed any of these annotations: org.springframework.web.bind.annotation.PathVariable,org.springframework.beans.factory.annotation.Autowired,org.springframework.web.bind.annotation.RequestMapping,org.springframework.stereotype.Controller,org.springframework.web.bind.annotation.RequestBody,javax.persistence.Table,org.springframework.stereotype.Service,com.fasterxml.jackson.annotation.JsonIgnore,javax.persistence.Enumerated,org.springframework.web.bind.annotation.ExceptionHandler,org.springframework.stereotype.Repository,javax.persistence.ManyToMany,javax.persistence.Id,org.springframework.web.bind.annotation.ControllerAdvice,javax.persistence.Entity,javax.persistence.ManyToOne,com.fasterxml.jackson.annotation.JsonBackReference,org.springframework.boot.autoconfigure.SpringBootApplication,javax.transaction.Transactional,javax.persistence.JoinColumn,javax.persistence.OneToMany,org.springframework.web.bind.annotation.RestController,javax.persistence.OneToOne,javax.persistence.Column,org.springframework.stereotype.Component,javax.persistence.GeneratedValue,javax.persistence.Transient,javax.annotation.PostConstruct,org.springframework.web.bind.annotation.RequestHeader,com.fasterxml.jackson.annotation.JsonManagedReference

您需要更多的pom.xml启动程序

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

 类似资料:
  • ./mvnw和mvn clean install在添加lombok依赖项时失败,但从Intellij IDE启动时成功运行。发现以下错误: 这是POJO

  • 嗨,evryone,我是开发JavaEE的新手,我想创建一个应用程序web,我已经创建了BD和ejb部分,其中包含包持久性、接口和服务,在war部分,我创建了包bean和webapp。。。。。我做了一个 请我需要帮助它已经4天寻找解决方案,我没有找到任何东西来帮助感谢所有

  • 错误:失败:生成失败,出现异常。*错误:任务“:app:ProcessDebugResources”执行失败。

  • 问题内容: 我试图构建新项目,但是当我单击构建时,构建每次都会失败。 我尝试删除我的项目并再次创建它,但是仍然没有帮助。 警告 错误 这些是Xcode向我显示的错误消息。项目名称为“ MyFirstApp”,我在该错误消息上剪切了一些文件路径。那么我如何建立这个项目呢? 问题答案: 在终端中尝试:

  • 我面临这个问题已经有一段时间了,我必须每30分钟重新克隆我的项目,因为这个错误显示,不让我建立我的项目。 `失败:生成失败,出现异常。 > try:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的洞察力。 在https://help.gradle.org获得更多帮助 在6s中生成失败异常:Gradle

  • 问题内容: 所有其他C#项目文件都使用MSBuild脚本构建。但是,很少有与C ++相关的项目因以下错误而失败- C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V110 \ Microsoft.Cpp.Platform.targets(44,5):错误MSB8020:v140的构建工具(Platform Toolset =’v14