java - 错误 : "Copying the source file <Unknown>"

标签 java ant jenkins findbugs

我正在学校管理的共享服务器上开展 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

在"file"选项卡下的 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 构建。

最佳答案

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

关于java - 错误 : "Copying the source file <Unknown>",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18429838/

相关文章:

java - 针对多个浏览器运行 selenium webdriver 测试用例

maven - 有没有办法通过 settings.xml 禁用 maven-deploy-plugin 的部署目标

java - :form and sf:form in spring? 形式有什么区别

javascript - WebSocket 可以替代 Java applet 吗?

java - 如何读取java中字符之间的多个标记?

java - 为什么使用 ant 运行 java 时无法获取用户输入?

java - getResourceAsStream() 在 eclipse 中工作正常,但在 jar 中失败

java - Ant 错误 "Exception in thread "AWT-EventQueue- 0"java.lang.NoClassDefFoundError: com/sun/jna/Library"

jenkins - 如何从脚本 [SonarQube 6.5] 动态分配质量门到项目?

java - 使用 Maven 运行的 Jenkins Junit 案例出现问题