Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7184

not able to display java source, if sourcePath is not root

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • findbugs-plugin
    • None
    • Solaris, Tomcat6, Java6

    Description

      i have created a one-in-all ant target, which executes findbugs, checkstyle & pmd for the given $srcDir, $classesDir.
      Works as expected, and the Hudson Plugins do their job.

      Unfortunately, i just wanted to analyze a specific directory, so i set my $srcDir to $srcDir/com/mycompany/myapp/beans.
      ($classesDir respectively to $classesDir/com/mycompany/myapp/beans)
      Ant targets run as expected, analyzing only this folder, XML output looks fine
      Checkstyle & PMD Plugins work as expected, can click till the java sources
      Only the findbugs plugin complains about not finding the source file for displaying....

      Copying the source file 'com/mycompany/myapp/beans/pitches/PitchDataBean.java' from the workspace to the build folder '/export/home/tomcat/.hudson/jobs/myapp_trunk/builds/2010-08-11_15-14-43/workspace-files/fda28c.tmp' on the Hudson master failed.
      Seems that the path is relative, however an absolute path is required when copying the sources.
      Is the file 'PitchDataBean.java' contained more than once in your workspace?
      Is the file 'com/mycompany/myapp/beans/pitches/PitchDataBean.java' a valid filename?
      If you are building on a slave: please check if the file is accessible under '$HUDSON_HOME/[job-name]/com/mycompany/myapp/beans/pitches/PitchDataBean.java'
      If you are building on the master: please check if the file is accessible under '$HUDSON_HOME/[job-name]/workspace/com/mycompany/myapp/beans/pitches/PitchDataBean.java'
      hudson.util.IOException2: remote file operation failed: com/mycompany/myapp/beans/pitches/PitchDataBean.java at hudson.remoting.LocalChannel@15bbe8
      at hudson.FilePath.act(FilePath.java:749)
      at hudson.FilePath.act(FilePath.java:735)
      at hudson.FilePath.copyTo(FilePath.java:1360)
      at hudson.plugins.analysis.core.HealthAwarePublisher.copyFilesWithAnnotationsToBuildFolder(HealthAwarePublisher.java:264)
      at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:226)
      at hudson.tasks.BuildStepMonitor$2.perform(BuildStepMonitor.java:27)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:580)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:558)
      at hudson.model.Build$RunnerImpl.post2(Build.java:158)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
      at hudson.model.Run.run(Run.java:1280)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:127)
      Caused by: java.io.FileNotFoundException: com/mycompany/myapp/beans/pitches/PitchDataBean.java (No such file or directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(FileInputStream.java:106)
      at hudson.FilePath$30.invoke(FilePath.java:1364)
      at hudson.FilePath$30.invoke(FilePath.java:1360)
      at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1899)
      at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
      at hudson.FilePath.act(FilePath.java:742)
      ... 14 more

      Attachments

        Activity

          drulli Ulli Hafner added a comment -

          Is the file 'PitchDataBean.java' contained more than once in your workspace?

          drulli Ulli Hafner added a comment - Is the file 'PitchDataBean.java' contained more than once in your workspace?
          drulli Ulli Hafner added a comment -

          Can you please attach your findbugs.xml file?

          drulli Ulli Hafner added a comment - Can you please attach your findbugs.xml file?
          myron0815 Myron0815 added a comment -

          1) no, this file is there only once. And it does not work with any file

          2) attaching my generated findbugs.xml
          the "missing classes for analysis" are the ones, i'd like to have removed (com.mycompany.webservices)

          ant target like that
          <findbugs home="${findbugs.dir}" output="xml" outputFile="findbugs.xml" jvmargs="-Xms265m -Xmx265m">
          <sourcePath path="${srcDir}/com/mycompany/myapp/beans" />
          <auxClasspath path="${classpath}" />
          <class location="${classesDir}/com/mycompany/myapp/beans" />
          </findbugs>

          regarding the path in the exception "$HUDSON_HOME/[job-name]/workspace/com/mycompany/myapp/beans/pitches/PitchDataBean.java"
          Maybe this is only a typo in the message, but the path is not correct.
          It is missing the checkout name "trunk" in the workspace?!
          The file would be accessible in $HUDSON_HOME/[job-name]/workspace/trunk/com/mycompany/myapp/beans/pitches/PitchDataBean.java

          I don't know how you compile the path; but if you use the findbugs.xml SrcDir+sourcepath, this wont work in this case...
          (This might be the reason why it works when specifying the $srcDir only)
          And checkstyle & PMD lists the absolute path in their XMLs.... so no problem there.

          myron0815 Myron0815 added a comment - 1) no, this file is there only once. And it does not work with any file 2) attaching my generated findbugs.xml the "missing classes for analysis" are the ones, i'd like to have removed (com.mycompany.webservices) ant target like that <findbugs home="${findbugs.dir}" output="xml" outputFile="findbugs.xml" jvmargs="-Xms265m -Xmx265m"> <sourcePath path="${srcDir}/com/mycompany/myapp/beans" /> <auxClasspath path="${classpath}" /> <class location="${classesDir}/com/mycompany/myapp/beans" /> </findbugs> regarding the path in the exception "$HUDSON_HOME/ [job-name] /workspace/com/mycompany/myapp/beans/pitches/PitchDataBean.java" Maybe this is only a typo in the message, but the path is not correct. It is missing the checkout name "trunk" in the workspace?! The file would be accessible in $HUDSON_HOME/ [job-name] /workspace/trunk/com/mycompany/myapp/beans/pitches/PitchDataBean.java I don't know how you compile the path; but if you use the findbugs.xml SrcDir+sourcepath, this wont work in this case... (This might be the reason why it works when specifying the $srcDir only) And checkstyle & PMD lists the absolute path in their XMLs.... so no problem there.
          myron0815 Myron0815 added a comment -

          please remove first upload

          myron0815 Myron0815 added a comment - please remove first upload
          drulli Ulli Hafner added a comment -

          Ok, I see. The problem is that findbugs does not correctly handle that case. As you already guessed: I'm using the findbugs library to read the xml file, which evaluates the source path as 'SrcDir+sourcepath'.

          drulli Ulli Hafner added a comment - Ok, I see. The problem is that findbugs does not correctly handle that case. As you already guessed: I'm using the findbugs library to read the xml file, which evaluates the source path as 'SrcDir+sourcepath'.
          drulli Ulli Hafner added a comment -

          Can't you use a findbugs exclusion filter instead of changing the folders?

          drulli Ulli Hafner added a comment - Can't you use a findbugs exclusion filter instead of changing the folders?
          myron0815 Myron0815 added a comment -

          well, yes. i tried that already.
          It might work for one project.
          But since my ant target is called by more projects, i cant use a fixed exclusion. (at least, i didn't know how to make this generic yet )
          And i need the "uncommon" srcDir anyway for checkstyle & PMD...

          I see, that's not a problem of the plugin...
          So this is a findbugs bug, to have always a correct sourcepath relative to the SrcDir?!
          (probably should better ask at SF tracker)

          otherwise... i could try to fix the SrcDir after generation;
          Thanks for your fast response

          myron0815 Myron0815 added a comment - well, yes. i tried that already. It might work for one project. But since my ant target is called by more projects, i cant use a fixed exclusion. (at least, i didn't know how to make this generic yet ) And i need the "uncommon" srcDir anyway for checkstyle & PMD... I see, that's not a problem of the plugin... So this is a findbugs bug, to have always a correct sourcepath relative to the SrcDir?! (probably should better ask at SF tracker) otherwise... i could try to fix the SrcDir after generation; Thanks for your fast response
          drulli Ulli Hafner added a comment -

          Ok. What I'm still wondering is why the fallback algorithm is not invoked. Are there log messages in the console log of the form:

          Building cache of all workspace files to obtain absolute filenames for all warnings.

          Can you please also add the findbugs-warnings.xml file in order to see the actual results?

          drulli Ulli Hafner added a comment - Ok. What I'm still wondering is why the fallback algorithm is not invoked. Are there log messages in the console log of the form: Building cache of all workspace files to obtain absolute filenames for all warnings. Can you please also add the findbugs-warnings.xml file in order to see the actual results?
          myron0815 Myron0815 added a comment -

          we have a fallback algorithm?! nice ^^

          you are correct, there are a bunch of warnings

          Aug 12, 2010 4:12:39 PM hudson.plugins.findbugs.parser.FindBugsParser parse
          WARNING: Can't resolve absolute file name for file PitchDataBean.java, dir list = [/export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/src/com/mycompany/myapp, /export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/findbugs.xml/src/main/java, /export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/findbugs.xml/src/test/java, /export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/findbugs.xml/src]
          Aug 12, 2010 4:12:39 PM hudson.plugins.analysis.core.ParserResult populateFileNameCache
          INFO: Building cache of all workspace files to obtain absolute filenames for all warnings.
          Aug 12, 2010 4:12:39 PM hudson.plugins.analysis.core.ParserResult populateFileNameCache
          INFO: Relative filenames [asm-3.1.jar, build.properties, db.properties, jaxen-1.1.1.jar, log4j.properties, package.html, pitch.properties, pitchDelivery.properties, pitchExpiryWarning.vm, pitchPrepareError.vm, pitchRequest.properties, spring-config.xml, web.xml, ?] found more than once; absolute filename resolution disabled for these files.

          seems you fallback algorithm doesn't cover my weird setup either...
          maybe we need some "while fileNotFound strip off first directory from fileName and try again"?!

          myron0815 Myron0815 added a comment - we have a fallback algorithm?! nice ^^ you are correct, there are a bunch of warnings Aug 12, 2010 4:12:39 PM hudson.plugins.findbugs.parser.FindBugsParser parse WARNING: Can't resolve absolute file name for file PitchDataBean.java, dir list = [/export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/src/com/mycompany/myapp, /export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/findbugs.xml/src/main/java, /export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/findbugs.xml/src/test/java, /export/home/tomcat/.hudson/jobs/myapp_trunk/workspace/trunk/findbugs.xml/src] Aug 12, 2010 4:12:39 PM hudson.plugins.analysis.core.ParserResult populateFileNameCache INFO: Building cache of all workspace files to obtain absolute filenames for all warnings. Aug 12, 2010 4:12:39 PM hudson.plugins.analysis.core.ParserResult populateFileNameCache INFO: Relative filenames [asm-3.1.jar, build.properties, db.properties, jaxen-1.1.1.jar, log4j.properties, package.html, pitch.properties, pitchDelivery.properties, pitchExpiryWarning.vm, pitchPrepareError.vm, pitchRequest.properties, spring-config.xml, web.xml, ?] found more than once; absolute filename resolution disabled for these files. seems you fallback algorithm doesn't cover my weird setup either... maybe we need some "while fileNotFound strip off first directory from fileName and try again"?!
          drulli Ulli Hafner added a comment -

          I fixed JENKINS-3488 today. Hopefully, this fixes your issue, too.

          drulli Ulli Hafner added a comment - I fixed JENKINS-3488 today. Hopefully, this fixes your issue, too.
          myron0815 Myron0815 added a comment -

          Yes, indeed.
          It's working now.
          Thanks!

          myron0815 Myron0815 added a comment - Yes, indeed. It's working now. Thanks!

          People

            drulli Ulli Hafner
            Myron0815 Myron0815
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: