Jacoco Agent in Maven is unusable

Anonymous
2012-08-20
2013-04-24
  • Anonymous - 2012-08-20

    The MANIFEST.MF file of the org.jacoco.agent JAR is unusable as a javaagent since it does not have the Premain-Class attribute. Nor does it pull any dependencies?

    hence, integrating it manually by pulling it from the repository is impossible. This makes custom integration into maven basically impossible.

    The MANIFEST.MF from the manual download of jacocoagent.jar shows:

    Premain-Class: org.jacoco.agent.rt_cdwjjf.JacocoAgent

    but the MAINFEST.MF from

    http://mvnrepository.com/artifact/org.jacoco/org.jacoco.agent/0.5.9.201207300726

    shows none of it:

    Manifest-Version: 1.0
    Export-Package: org.jacoco.agent
    Bundle-Vendor: Mountainminds GmbH & Co. KG
    Bundle-Version: 0.5.9.201207300726
    Build-Jdk: 1.6.0_33
    Built-By: godin
    Bundle-Name: JaCoCo Agent
    Bundle-ManifestVersion: 2
    Created-By: Apache Maven
    Bundle-SymbolicName: org.jacoco.agent
    Bundle-RequiredExecutionEnvironment: J2SE-1.5
    Archiver-Version: Plexus Archiver

    Name: org/jacoco/agent/AgentJar.class
    SHA1-Digest: 0gqeu126l0/R/8ZGVFbGo9nTLyQ=

    Name: META-INF/maven/org.jacoco/org.jacoco.agent/pom.properties
    SHA1-Digest: eLUNFDEvM0Y2nb7iH64YFOyuL50=

    Name: about.html
    SHA1-Digest: QJm36e4khW+xiAT8m61KUaoXfIA=

    Name: org/jacoco/agent/package-info.class
    SHA1-Digest: jN47DabpU/bFA2OtHze0ze/2sIA=

    Name: jacocoagent.jar
    SHA1-Digest: jDbAvbcWD7VcvaIjg6Pel+lowrA=

    Name: META-INF/maven/org.jacoco/org.jacoco.agent/pom.xml
    SHA1-Digest: eiPbaIs08ynMZlCRzyzfE1AykIU=

    We have a custom app that the Maven plugin does not work with (specialized FAT JAR with embedded web server) so we need to do some custom integration….

     
  • Anonymous - 2012-08-20

    Is there a way to pull in the actual agent JAR from Maven then, so that it can be passed in as a command line -javaagent argument?

     
  • Marc R. Hoffmann

    There is. The jacocoagent.jar is available via the classifier "runtime".

     
  • Anonymous - 2012-08-20

    Got it, I am trying this now, thanks

     
  • Anonymous - 2012-08-20

    Is there some magic to getting the runtime jar to download? When I just do this in the pom.xml

                <dependency>
                    <groupId>org.jacoco</groupId>
                    <artifactId>org.jacoco.agent</artifactId>
                    <version>0.5.9.201207300726</version>
                </dependency>
    

    it just downloads the agent.jar, but not the runtime:

    ls org.jacoco.agent/0.5.9.201207300726/
    org.jacoco.agent-0.5.9.201207300726.jar  
    org.jacoco.agent-0.5.9.201207300726.jar.sha1  
    org.jacoco.agent-0.5.9.201207300726.pom  
    org.jacoco.agent-0.5.9.201207300726.pom.sha1
    

    the runtime.jar does not get pulled in via Maven….I've deleted the folder in the repo to re-force a download again and every time it does the same thing….

     
  • Anonymous - 2012-08-20

    Got it, sorry…use Google, I know…

                <dependency>
                    <groupId>org.jacoco</groupId>
                    <artifactId>org.jacoco.agent</artifactId>
                    <version>0.5.9.201207300726</version>
                    <classifier>runtime</classifier>
                </dependency>