Blog

Maven build error: “Caused by: java.io.IOException: Incompatible version 1007”

I was encountering this error in Jenkins when it tried to build a project I was working on:


Caused by: java.io.IOException: Incompatible version 1007.
at org.jacoco.core.data.ExecutionDataReader.readHeader(ExecutionDataReader.java:127)
at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:107)
at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:87)
at org.sonar.plugins.jacoco.AbstractAnalyzer.readExecutionData(AbstractAnalyzer.java:134)
at org.sonar.plugins.jacoco.AbstractAnalyzer.analyse(AbstractAnalyzer.java:107)

The problem was due to a breakage/bug in the jacoco-maven-plugin. To fix, simply add a version in your pom.xml, like so:


<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.4.201502262128</version>
    <executions>
        <execution>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
    </executions>
</plugin>

That’s it!

Seven performance metrics for Java applications

I came across this in this blog post and am adding it here as a checklist. It’s a worthwhile list to have so you can understand how your Java app behaves in production.

  1. Response times and throughput
  2. Load Average
  3. Error Rates (and how to solve them)
  4. GC rate and pause duration
  5. Business Metrics
  6. Uptime and service health
  7. Log size

Maven Error: “Bare Repository has neither a working tree, nor an index”

I suddenly couldn’t build a Maven project at work because of the error below…. Did some googling but didn’t really find helpful info, other than that I was touching a “bare” repository. I thought about it for a second and realized that maybe my changing the artifact version in the pom had something to do with it (I did this as another branch had increased the version).

I quickly rolled it back to the previous version, committed and pushed, and, voila, Jenkins started building my project successfully again.

Adding it here in case someone gets bit with this [annoying] error.


18:17:46 [info] HEAD is [ de8cb9011de6b1fc101ac8133875aaf076b9bbe3 ]
18:17:46 org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
18:17:46 at org.eclipse.jgit.lib.Repository.getWorkTree(Repository.java:1246)
18:17:46 at org.eclipse.jgit.treewalk.FileTreeIterator.(FileTreeIterator.java:88)
18:17:46 at org.eclipse.jgit.api.StatusCommand.call(StatusCommand.java:126)
18:17:46 at pl.project13.jgit.DescribeCommand.findDirtyState(DescribeCommand.java:360)
18:17:46 at pl.project13.jgit.DescribeCommand.call(DescribeCommand.java:296)
18:17:46 at pl.project13.maven.git.JGitProvider.getGitDescribe(JGitProvider.java:225)
18:17:46 at pl.project13.maven.git.JGitProvider.getGitDescribe(JGitProvider.java:122)
18:17:46 at pl.project13.maven.git.GitDataProvider.maybePutGitDescribe(GitDataProvider.java:93)
18:17:46 at pl.project13.maven.git.GitDataProvider.loadGitData(GitDataProvider.java:63)
18:17:46 at pl.project13.maven.git.GitCommitIdMojo.loadGitDataWithJGit(GitCommitIdMojo.java:485)
18:17:46 at pl.project13.maven.git.GitCommitIdMojo.loadGitData(GitCommitIdMojo.java:457)
18:17:46 at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:315)
18:17:46 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
18:17:46 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
18:17:46 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
18:17:46 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
18:17:46 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
18:17:46 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
18:17:46 at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
18:17:46 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
18:17:46 at java.lang.reflect.Method.invoke(Method.java:483)
18:17:46 at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
18:17:46 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
18:17:46 at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
18:17:46 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
18:17:46 at java.lang.reflect.Method.invoke(Method.java:483)
18:17:46 at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
18:17:46 at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
18:17:46 at hudson.remoting.UserRequest.perform(UserRequest.java:121)
18:17:46 at hudson.remoting.UserRequest.perform(UserRequest.java:49)
18:17:46 at hudson.remoting.Request$2.run(Request.java:324)
18:17:46 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
18:17:46 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
18:17:46 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
18:17:46 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
18:17:46 at java.lang.Thread.run(Thread.java:744)

My custom bash prompt

I wanted more information in my bash prompt, such as date/time and the directory I was in.  Here’s what it looks like:

bash_prompt

And this is what I added in my ~/.bash_profile:


PS1='${debian_chroot:+($debian_chroot)}\d \T &gt; \[$(tput sgr0)\]\[\033[01;32m\]\u@\h\[\033[00m\] : \[\033[01;34m\]\w\[\033[00m\]\n\$ '

Run source ~/.bash_profile and enjoy. 🙂

BTW, there’s also a website that you can use to create your own: http://bashrcgenerator.com/.