From: Charles B. <Cha...@eb...> - 2005-04-01 02:04:16
|
Hi Jared, Here's a bit of a maven plugin primer for you. In summary, until the cobertura plugin can be distributed as part of the maven project, I would add the source for the plugin into the cobertura CVS tree, build the plugin, and make it available for users to download from the cobertura website using "maven plugin:download". You may also like to make the plugin's dependencies available somehow. Details on how to do all this below... Building the Plugin ------------------- The zip that I uploaded to JIRA is the source for the cobertura maven plugin. To use it it needs to be packaged into a jar. You can do this by running "maven plugin:install". This will package it up in a jar (target/maven-cobertura-plugin-1.0.0.jar) and put it in your maven plugin dir ($MAVEN_HOME/plugins). Alternatively you could probably simply rename the zip I uploaded to a jar and manually copy it to the plugins dir. Distributing the plugin ----------------------- Eventually you probably want to lobby the maven project to have the cobertura plugin distributed along with the maven releases, and have the source hosted and maintained as part of the maven project. Given that this process will take some time, and maven releases are pretty infrequent, you probably want to make it available from the cobertura website in the interim. To do this: - Build the plugin - Put the build plugin in a directory "maven/cobertura/plugins" on the cobertura website. - Users should now be able to download the plugin with the following command: maven -Dmaven.repo.remote=http://www.ibiblio.org/maven,http://cobertura.sourceforge.net/maven -DgroupId=cobertura -DartifactId=maven-cobertura-plugin -Dversion=1.0.0 plugin:download - The plugin should then be available for use. Dependencies ------------ Maven downloads all dependency jars from external repositories (eg: http://www.ibiblio.org/maven). Each dependency is identified by a groupId, a name and a version. So if maven needs a dependency with a groupId of "asm", a name of "asm" and a version "1.5.2" it will look in each external repository for a file "asm/jars/asm-1.5.2.jar". The cobertura plugin I wrote depends on the following (groupId/name/version): cobertura/cobertura/1.2 asm/asm/2.0.RC1 log4j/log4j/1.2.8 urbanophile/java-getopt/1.0.9 ncss/javancss/21.41 ncss/ccl/21.41 Of these, I couldn't find the cobertura, asm, and the ncss jars on the public maven repo (www.ibiblio.org/maven). This will cause errors when users try to run the plugin, as not all deps will be found. There are a few options to fix this: - Tell users they need to install these dependencies into their local maven repo manually and give them instructions on how to do this. - Upload the missing dependencies to the public maven repo on ibiblio. Not sure what the process for this is. Its probably on the maven website. - Upload the missing dependencies to the maven repo on the cobertura website (ie: where you put the plugin). Then users will have to run the cobertura plugin with the "-Dmaven.repo.remote=http://www.ibiblio.org/maven,http://cobertura.sourceforge.net/maven" option at least the first time they run it so that maven can find the dependencies. Hope this helps. Cheers, Charles Jared Richardson wrote: >Hi Charles, > >I'm starting to play with Maven but am not an expert (or even a good user!) yet. Should any part of your note be added to the Cobertura docs so that people know how to use the plugin or does Maven present that information to the end users? > >Jared > > > >>-----Original Message----- >>From: cob...@li... >>[mailto:cob...@li...] On >>Behalf Of Charles Blaxland >>Sent: Tuesday, March 29, 2005 7:34 PM >>To: cob...@li... >>Subject: Re: [Cobertura-devel] Maven plugin >> >>Hi All, >> >>[I tried sending this mail previously with the plugin as an >>attachment, but it >>didn't seem to work - apologies if you get this twice. I've >>now attached the >>plugin to the maven JIRA issue at >>http://jira.codehaus.org/browse/MPJCOVERAGE-25] >> >>I have created a basic maven plugin for Cobertura. It is >>based on the existing >>jcoverage plugin, however it does NOT support generating its >>own HTML report >>based on the XML coverage output as the existing jcoverage >>plugin does - rather >>it simply delegates to the cobertura-report ant task to do >>this work. The >>properties you can set are a subset of the jcoverage ones: >> >>maven.cobertura.dir=${maven.build.dir}/cobertura >>maven.cobertura.instrumentation=${maven.cobertura.dir}/classes >>maven.cobertura.junit.fork=yes >>maven.cobertura.instrumentation.includes=**/*.class >>maven.cobertura.instrumentation.excludes=NOT_DEFINED >> >>The "cobertura" goal will instrument, run the tests and generate the >>report. You can include the report in the site generation in >>the usual >>maven way. >> >>It depends on cobertura 1.2 at present. I couldn't find some of the >>dependencies on the maven repo on ibiblio, so there may be a few >>unsatisfied deps which require some manual installation when >>you run it >>(maybe these could be distributed with the plugin?). >> >>I've run it over a few of my projects (incl jdk1.5 ones) and >>it seems to >>work OK. >> >>Enjoy, >>Charles >> >> >> |