How to get rid of space in temp folder of jenkinsRule?

38 views
Skip to first unread message

Michael Carter

unread,
Jul 14, 2020, 4:02:20 PM7/14/20
to Jenkins Developers
Doing some research into this it suggested objects with spaces can cause this error.  The only space I could find is in the temp folder name.   Any way to get rid of that space?

Caused: java.io.IOException: While reading class directory: /my-plugin/target/tmp/j h1438579319153760688/jobs/jobname-FreeStyleJacocoOnlyTest/builds/1/jacoco/classes
 at hudson
.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:132)
 at hudson
.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:140)
 at hudson
.plugins.jacoco.JacocoReportDir.parse(JacocoReportDir.java:110)
 at hudson
.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:331)
 at hudson
.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:321)



Gavin Mogan

unread,
Jul 14, 2020, 4:09:28 PM7/14/20
to Jenkins Developers
Why would anything not shell related have problems with spaces in the file paths? Can you just update the code reading it?

I don't know how to remove the space, though honestly I don't think i've ever seen a space in the path but i've never looked carefully sorry.

Gavin

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/f7f89dc7-6113-481f-ab61-b18f9dfb2887o%40googlegroups.com.

Michael Carter

unread,
Jul 14, 2020, 4:24:19 PM7/14/20
to Jenkins Developers
Basically I'm running this:

      freeStyleProject = jenkinsRule.createFreeStyleProject("jobname-"+Thread.currentThread().getStackTrace()[1].getMethodName());
     
     
// shell script here to copy file from an already compiled hello world plugin

     
JacocoPublisher jacoco = new JacocoPublisher();
      freeStyleProject
.getPublishersList().add(jacoco);


      freeStyleProject
.getPublishersList().add(new MyTestPublisher("Test"));
     
      freeStyleProject
.save();
      run
= jenkinsRule.assertBuildStatus(Result.SUCCESS, freeStyleProject.scheduleBuild2(0));


The full output:

  48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Collecting JaCoCo coverage data...
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] **/**.exec;**/classes;**/src/main/java; locations are configured
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Number of found exec files for pattern **/**.exec: 1
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Saving matched execfiles:  /my-jenkins-plugin/target/tmp/j h5849944393216790880/workspace/jobname-FreeStyleJacocoOnlyTest/jacoco.exec
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Saving matched class directories for class-pattern: **/classes:
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin]  - /my-jenkins-plugin/target/tmp/j h5849944393216790880/workspace/jobname-FreeStyleJacocoOnlyTest/target/classes 3 files
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Saving matched source directories for source-pattern: **/src/main/java:
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Source Inclusions: **/*.java,**/*.groovy,**/*.kt,**/*.kts
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Source Exclusions:
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] - /my-jenkins-plugin/target/tmp/j h5849944393216790880/workspace/jobname-FreeStyleJacocoOnlyTest/src/main/java 1 files
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] Loading inclusions files..
 
48.772 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] inclusions: []
 
48.773 [jobname-FreeStyleJacocoOnlyTest #1] [JaCoCo plugin] exclusions: []
 
48.823 [jobname-FreeStyleJacocoOnlyTest #1] ERROR: Step ‘Record JaCoCo coverage report’ aborted due to exception:
 
48.823 [id=46] WARNING h.m.AbstractBuild$AbstractBuildExecution#reportError: Step ‘Record JaCoCo coverage report’ aborted due to exception:
java
.lang.IllegalArgumentException
 at org
.objectweb.asm.ClassVisitor.<init>(Unknown Source)
 at org
.jacoco.core.internal.flow.ClassProbesVisitor.<init>(ClassProbesVisitor.java:38)
 at org
.jacoco.core.internal.flow.ClassProbesVisitor.<init>(ClassProbesVisitor.java:28)
 at org
.jacoco.core.internal.analysis.ClassAnalyzer.<init>(ClassAnalyzer.java:59)
 at org
.jacoco.core.analysis.Analyzer$1.<init>(Analyzer.java:97)
 at org
.jacoco.core.analysis.Analyzer.createAnalyzingVisitor(Analyzer.java:94)
 at org
.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:114)
 at org
.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:132)
Caused: java.io.IOException: Error while analyzing /my-jenkins-plugin/target/tmp/j h5849944393216790880/jobs/jobname-FreeStyleJacocoOnlyTest/builds/1/jacoco/classes/io/jenkins/plugins/sample/HelloWorldBuilder$DescriptorImpl.class.
 at org
.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:162)
 at org
.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:134)
 at org
.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:157)
 at org
.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:193)
 at org
.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:226)
 at hudson
.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:129)
Caused: java.io.IOException: While reading class directory: /my-jenkins-plugin/target/tmp/j h5849944393216790880/jobs/jobname-FreeStyleJacocoOnlyTest/builds/1/jacoco/classes
 at hudson
.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:132)

 at hudson
.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:140)
 at hudson
.plugins.jacoco.JacocoReportDir.parse(JacocoReportDir.java:110)
 at hudson
.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:331)
 at hudson
.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:321)

 at hudson
.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:675)
 at hudson
.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
 at hudson
.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
 at hudson
.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
 at hudson
.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
 at hudson
.model.Build$BuildExecution.post2(Build.java:186)
 at hudson
.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
 at hudson
.model.Run.execute(Run.java:1905)
 at hudson
.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
 at hudson
.model.ResourceController.execute(ResourceController.java:97)
 at hudson
.model.Executor.run(Executor.java:428)


If I run outside the testing harness everything works fine.


On Tuesday, July 14, 2020 at 4:09:28 PM UTC-4, Gavin Mogan wrote:
Why would anything not shell related have problems with spaces in the file paths? Can you just update the code reading it?

I don't know how to remove the space, though honestly I don't think i've ever seen a space in the path but i've never looked carefully sorry.

Gavin

On Tue, Jul 14, 2020 at 1:02 PM Michael Carter <mikeyca...@gmail.com> wrote:
Doing some research into this it suggested objects with spaces can cause this error.  The only space I could find is in the temp folder name.   Any way to get rid of that space?

Caused: java.io.IOException: While reading class directory: /my-plugin/target/tmp/j h1438579319153760688/jobs/jobname-FreeStyleJacocoOnlyTest/builds/1/jacoco/classes
 at hudson
.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:132)
 at hudson
.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:140)
 at hudson
.plugins.jacoco.JacocoReportDir.parse(JacocoReportDir.java:110)
 at hudson
.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:331)
 at hudson
.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:321)



--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkin...@googlegroups.com.

Jesse Glick

unread,
Jul 14, 2020, 4:45:38 PM7/14/20
to Jenkins Dev
On Tue, Jul 14, 2020 at 4:24 PM Michael Carter
<mikeyca...@gmail.com> wrote:
> If I run outside the testing harness everything works fine.

Unless, presumably, a hapless user tries to use your plugin with a
path that contains spaces. That is the point of including the space in
the test harness: to remind you to fix this.

Michael Carter

unread,
Jul 14, 2020, 4:50:24 PM7/14/20
to Jenkins Developers
I found it... I was barking up the wrong tree.    

Added this to my pom.xml and everything started working.   Thanks for the help... sometimes I just need to explain things to someone else to find the problem ;)

        <dependency>
         
<groupId>org.jacoco</groupId>
         
<artifactId>org.jacoco.report</artifactId>
         
<version>0.8.5</version>
         
<scope>test</scope>
       
</dependency>

Reply all
Reply to author
Forward
0 new messages