1

我正在为 maven 使用 SpotBugs 插件

我已经能够创建自己的FilterFile并将其与 excludeFilterFile 配置一起使用。我使用了以下页面:SpotBugs Maven Plugin exclude a directory

我还能够使用https://spotbugs.readthedocs.io/en/latest/implement-plugin.html创建自己的 SpotBugs 插件实现,并在不同的模块中使用它。

当我尝试使用过滤器文件和我自己的 SpotBugs 插件实现时,出现错误。注意当我仅使用过滤器文件或仅使用我的自定义插件配置进行构建时,这可以正常工作。问题是当我定义两者时。这是一个错误还是我的配置有问题?

同样有趣的是,我能够在 Windows 机器上成功构建项目。看起来它是 Linux 机器独有的。

我的代码片段:

    <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs.version}</version>
        <executions>
            <execution>
                <configuration combine.self="override">
                    <excludeFilterFile>${basedir}/src/main/resources/spotBugsIgnore.xml</excludeFilterFile>
                    <plugins>
                        <plugin>
                            <groupId>veeva.ecm.framework</groupId>
                            <version>${version}</version>
                            <artifactId>spotbugs4caf</artifactId>
                        </plugin>
                    </plugins>
                </configuration>
                <phase>compile</phase>
                <id>run spotbugs</id>
                <goals>
                    <goal>spotbugs</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

我的错误:

11:59:30 [ERROR] Cannot create file-based resource. /home/centos/workspace/AutoInfra/Common_Automation_Framework_Commit/common-automation-framework/target/classes -> [Help 1]
11:59:30 org.codehaus.plexus.resource.loader.FileResourceCreationException: Cannot create file-based resource.
11:59:30    at org.codehaus.plexus.resource.loader.FileResourceLoader.getResourceAsFile(FileResourceLoader.java:112)
11:59:30    at org.codehaus.plexus.resource.loader.FileResourceLoader$getResourceAsFile.call(Unknown Source)
11:59:30    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:143)
11:59:30    at org.codehaus.mojo.spotbugs.ResourceHelper.getResourceAsFile(ResourceHelper.groovy:82)
11:59:30    at org.codehaus.mojo.spotbugs.ResourceHelper.getResourceFile(ResourceHelper.groovy:72)
11:59:30    at org.codehaus.mojo.spotbugs.ResourceHelper$getResourceFile.call(Unknown Source)
11:59:30    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsPluginsTrait$Trait$Helper$_getSpotbugsPlugins_closure2.doCall(SpotBugsPluginsTrait.groovy:105)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:59:30    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:59:30    at java.lang.reflect.Method.invoke(Method.java:497)
11:59:30    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
11:59:30    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326)
11:59:30    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
11:59:30    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
11:59:30    at groovy.lang.Closure.call(Closure.java:411)
11:59:30    at groovy.lang.Closure.call(Closure.java:427)
11:59:30    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2102)
11:59:30    at org.codehaus.groovy.runtime.dgm$181.invoke(Unknown Source)
11:59:30    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:246)
11:59:30    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:55)
11:59:30    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsPluginsTrait$Trait$Helper.getSpotbugsPlugins(SpotBugsPluginsTrait.groovy:96)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsPluginsTrait$Trait$Helper$getSpotbugsPlugins$0.call(Unknown Source)
11:59:30    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsMojo.getSpotbugsPlugins(SpotBugsMojo.groovy)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsMojo.getSpotbugsArgs(SpotBugsMojo.groovy:832)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:59:30    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:59:30    at java.lang.reflect.Method.invoke(Method.java:497)
11:59:30    at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
11:59:30    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
11:59:30    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:58)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsMojo.executeSpotbugs(SpotBugsMojo.groovy:1007)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:59:30    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:59:30    at java.lang.reflect.Method.invoke(Method.java:497)
11:59:30    at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
11:59:30    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
11:59:30    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:58)
11:59:30    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsMojo.canGenerateReport(SpotBugsMojo.groovy:547)
11:59:30    at org.codehaus.mojo.spotbugs.SpotBugsMojo.execute(SpotBugsMojo.groovy:682)
11:59:30    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
11:59:30    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
11:59:30    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
11:59:30    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
11:59:30    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
11:59:30    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
11:59:30    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
11:59:30    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
11:59:30    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
11:59:30    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
11:59:30    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
11:59:30    at org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:59:30    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:59:30    at java.lang.reflect.Method.invoke(Method.java:497)
11:59:30    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
11:59:30    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
11:59:30    at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:59:30    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:59:30    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:59:30    at java.lang.reflect.Method.invoke(Method.java:497)
11:59:30    at hudson.maven.Maven3Builder.call(Maven3Builder.java:139)
11:59:30    at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
11:59:30    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
11:59:30    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
11:59:30    at hudson.remoting.Request$2.run(Request.java:326)
11:59:30    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
11:59:30    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
11:59:30    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
11:59:30    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
11:59:30    at java.lang.Thread.run(Thread.java:745)
11:59:30 Caused by: java.nio.file.DirectoryNotEmptyException: /home/centos/workspace/AutoInfra/Common_Automation_Framework_Commit/common-automation-framework/target/classes
11:59:30    at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:564)
11:59:30    at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
11:59:30    at java.nio.file.Files.copy(Files.java:1274)
11:59:30    at org.codehaus.plexus.util.NioFiles.copy(NioFiles.java:140)
11:59:30    at org.codehaus.plexus.util.FileUtils.doCopyFileUsingNewIO(FileUtils.java:1150)
11:59:30    at org.codehaus.plexus.util.FileUtils.doCopyFile(FileUtils.java:1100)
11:59:30    at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1085)
11:59:30    at org.codehaus.plexus.resource.loader.FileResourceLoader.getResourceAsFile(FileResourceLoader.java:106)
11:59:30    ... 87 more
4

0 回答 0