aspose file tools*
The moose likes Testing and the fly likes Findbugs can't find -outputFile?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Findbugs can Watch "Findbugs can New topic
Author

Findbugs can't find -outputFile??

Jane Foster
Greenhorn

Joined: Jun 16, 2009
Posts: 13
Can anyone help me figure out this error, it is driving me crazy!

I am getting the following error when running findbugs:
Note: My build file is being executed via hudson


[echo] Running Findbugs
[findbugs] Executing findbugs from ant task
[findbugs] Running FindBugs...
[findbugs] Exception in thread "main" java.io.FileNotFoundException: C:\hudson\jobs\Job1\workspace\Job2\-outputFile (The system cannot find the file specified)
[findbugs] at java.util.zip.ZipFile.open(Native Method)
[findbugs] at java.util.zip.ZipFile.<init>(ZipFile.java:114)
[findbugs] at java.util.zip.ZipFile.<init>(ZipFile.java:131)
[findbugs] at edu.umd.cs.findbugs.classfile.impl.ZipFileCodeBase.<init>(ZipFileCodeBase.java:53)
[findbugs] at edu.umd.cs.findbugs.classfile.impl.ZipCodeBaseFactory.makeZipCodeBase(ZipCodeBaseFactory.java:40)
[findbugs] at edu.umd.cs.findbugs.classfile.impl.ClassFactory.createFilesystemCodeBase(ClassFactory.java:96)
[findbugs] at edu.umd.cs.findbugs.classfile.impl.FilesystemCodeBaseLocator.openCodeBase(FilesystemCodeBaseLocator.java:75)
[findbugs] at edu.umd.cs.findbugs.classfile.impl.ClassPathBuilder.processWorkList(ClassPathBuilder.java:560)
[findbugs] at edu.umd.cs.findbugs.classfile.impl.ClassPathBuilder.build(ClassPathBuilder.java:195)
[findbugs] at edu.umd.cs.findbugs.FindBugs2.buildClassPath(FindBugs2.java:626)
[findbugs] at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:184)
[findbugs] at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:323)
[findbugs] at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1069)
[findbugs] Output saved to findbugs_report.xml

I am checking out 2 projects in the same workspace. I have several jobs I do this with and am only getting an error on this one.
My build file looks like this:

<project name="Job2" default="findbugs">

<!-- Properties -->
<property file="build.properties" />

<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${jar.lib.dir}\findbugs.jar"/>

<target name="findbugs"
description="Generates a report of potential code bugs found.">
<echo>Running Findbugs</echo>
<findbugs home="${jar.lib.dir}" output="xml" outputFile="findbugs_report.xml">
<auxClasspath>
<fileset dir="${env.WORKSPACE}/${env.JOB_NAME}/lib"
includes="*.jar"/>
</auxClasspath>
<sourcePath path="${env.WORKSPACE}/${env.JOB_NAME}/src" />
<class location="${env.WORKSPACE}/${env.JOB_NAME}/bin" />
</findbugs>
</target>
</project>

My build properties looks like this:

# Configuration
#---------------------
jar.lib.dir=${basedir}/lib


My workspace structure
Hudson
---- jobs
-----------Job1
----------------workspace
--------------------------Job1
--------------------------bin
--------------------------CVS
--------------------------dist
--------------------------etc
--------------------------src
--------------------------test
--------------------------build.xml
--------------------------build.properties
------------Job2
--------------------------lib
-----------------------------The following jars: annotations, ant, asm-3.1, asm-analysis, asm-commons, asm-tree, asm-util, asm-xml, bcel, commons-lang, dom4j-1.6.1, findbugs, findbugs-ant, jaxen-1.1, jFormatString, jsr305
--------------------------CVS
--------------------------build.xml
--------------------------build.properties
--------------------------checkstyle_report.xml
--------------------------findbugs_report.xml
--------------------------sun_checks.xml


My project has all the findbugs jar in a lib folder in the project basedir.
The workspace and Job_Name variables are coming from hudson, I don't see any problem with them when I run it.
Thanks in advance.


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42625
    
  65
The error message makes sense, since there is no "Job2" directory underneath "workspace".


Ping & DNS - my free Android networking tools app
Jane Foster
Greenhorn

Joined: Jun 16, 2009
Posts: 13
There actually is. I made a mistake when I was typing that up. Here is the corrected structure:

My workspace structure
Hudson
---- jobs
-----------Job1
----------------workspace
--------------------------Job1
--------------------------bin
--------------------------CVS
--------------------------dist
--------------------------etc
--------------------------src
--------------------------test
--------------------------build.xml
--------------------------build.properties

--------------------------Job2
--------------------------lib
-----------------------------The following jars: annotations, ant, asm-3.1, asm-analysis, asm-commons, asm-tree, asm-util, asm-xml, bcel, commons-lang, dom4j-1.6.1, findbugs, findbugs-ant, jaxen-1.1, jFormatString, jsr305
--------------------------CVS
--------------------------build.xml
--------------------------build.properties
--------------------------checkstyle_report.xml
--------------------------findbugs_report.xml
--------------------------sun_checks.xml


Job1 and Job2 are both in the workspace folder. Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42625
    
  65
Maybe a permissions issue? FileNotFoundException is also thrown in case of insufficient access privileges.

The trailing "-outputFile" is strange, though - that's the command line switch used for the output file name.
Jane Foster
Greenhorn

Joined: Jun 16, 2009
Posts: 13
For some reason, when findbugs runs, it is not creating the output file.
I wiped out the hudson workspace and built the job again and it created teh checkstyle file but not findbugs...

I cannot understand why this would happen, I have 4 other jobs using the exact configuration and ant build and none of them are running into this.

Can you think of any reason why it would not be able to create the findbugs_report file?
David Coleman
Greenhorn

Joined: Jan 12, 2010
Posts: 1
I had the same problem. Getting rid of the empty <auxClasspath/> property should fix your problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Findbugs can't find -outputFile??