4

我正在我学校管理的共享服务器上开发 Jenkins 项目。我的build.xml文件有以下 FindBugs 执行的相关步骤:

<target name="findbugs">
    <echo>FindBugs Starting:</echo>

    <available file="${findbugs.dir}/findbugs.jar" property="findbugs.available" />
    <fail unless="findbugs.available" message="Error: FINDBUGS_HOME not set or findbugs.jar not found." />

    <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.dir}/findbugs-ant.jar" />
    <findbugs home="${findbugs.dir}"
        workHard="true"
        output="xml:withMessages"
        outputFile="${report.dir}/findbugs.xml"
        excludefilter="findbugs-exclusions.xml"
        sourcePath="${src.dir}" >
        <class location="${classes.dir}" />
        <auxClasspath>
            <fileset file="${lib.dir}/junit.jar" />
        </auxClasspath>
     </findbugs>

    <echo>FindBugs finished</echo>
</target>

执行时,Jenkins 控制台上的输出不包含任何错误,但据我所知显示执行干净:

     [echo] FindBugs Starting:
 [findbugs] Executing findbugs from ant task
 [findbugs] Running FindBugs...
 [findbugs] Warnings generated: 24
 [findbugs] Calculating exit code...
 [findbugs] Setting 'bugs found' flag (1)
 [findbugs] Exit code set to: 1
 [findbugs] Java Result: 1
 [findbugs] Output saved to report/findbugs.xml
     [echo] FindBugs finished

在“文件”选项卡下的 FindBugs 警告的结果中,列出了一个名为“”的文件,在该详细信息中,我看到以下内容:

 com.ewenicorn.reddit.dailyprogrammer.utility.CharacterUtilityTest.testShiftCharacter() invokes inefficient new Character(char) constructor; use Character.valueOf(char) instead
01 Copying the source file 'com/ewenicorn/reddit/dailyprogrammer/utility/<Unknown>' from the workspace to the build folder '/home/VLE/1257538/jenkins/jobs/RedditDailyProgrammer/builds/2013-08-24_16-50-28/workspace-files/f2082c83.tmp' on the Jenkins master failed.
02 Seems that the path is relative, however an absolute path is required when copying the sources.
03 Is the file '<Unknown>' contained more than once in your workspace?
04 Is the file 'com/ewenicorn/reddit/dailyprogrammer/utility/<Unknown>' a valid filename?
05 If you are building on a slave: please check if the file is accessible under '$JENKINS_HOME/[job-name]/com/ewenicorn/reddit/dailyprogrammer/utility/<Unknown>'
06 If you are building on the master: please check if the file is accessible under '$JENKINS_HOME/[job-name]/workspace/com/ewenicorn/reddit/dailyprogrammer/utility/<Unknown>'
07 hudson.util.IOException2: remote file operation failed: com/ewenicorn/reddit/dailyprogrammer/utility/<Unknown> at hudson.remoting.LocalChannel@4d948ad7
08   at hudson.FilePath.act(FilePath.java:905)
09   at hudson.FilePath.act(FilePath.java:882)
10   at hudson.FilePath.copyTo(FilePath.java:1776)
11   at hudson.plugins.analysis.core.HealthAwareRecorder.copyFilesWithAnnotationsToBuildFolder(HealthAwareRecorder.java:398)
12   at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:165)
13   at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:333)
14   at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
15   at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
16   at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
17   at hudson.model.Build$BuildExecution.post2(Build.java:183)
18   at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
19   at hudson.model.Run.execute(Run.java:1628)
20   at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
21   at hudson.model.ResourceController.execute(ResourceController.java:88)
22   at hudson.model.Executor.run(Executor.java:247)
23 Caused by: java.io.FileNotFoundException: com/ewenicorn/reddit/dailyprogrammer/utility/<Unknown> (No such file or directory)
24   at java.io.FileInputStream.open(Native Method)
25   at java.io.FileInputStream.<init>(FileInputStream.java:137)
26   at hudson.FilePath$34.invoke(FilePath.java:1781)
27   at hudson.FilePath$34.invoke(FilePath.java:1776)
28   at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2417)
29   at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
30   at hudson.FilePath.act(FilePath.java:898)
31   ... 14 more

我正在寻找解决此错误的方法,因此感谢您提供任何可用的帮助,特别是因为我没有从以前研究此问题的人那里找到任何东西。如果需要额外的结构,可以在https://github.com/jenrmagas/RedditDailyProgrammer找到文件的完整源代码和二进制文件,它应该可以开箱即用地使用 Ant 构建。

4

1 回答 1

0

“未知源文件”很可能是由于在没有调试信息的情况下编译代码。

于 2013-11-12T00:22:17.490 回答