我正在我学校管理的共享服务器上开展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。
答案 0 :(得分:0)
“未知源文件”很可能是由于代码在没有调试信息的情况下编译。