[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Using Sonar with Cobertura and an ITD

Thanks andy -- For the sake of anyone googling I went ahead and excluded the aspects from cobertura instrumentation with (standard exclusion, which Sonar picks up):

       <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <configuration>
          <instrumentation>
            <excludes>
              <exclude>com/argodata/core/aspect/CreatedTime.class</exclude>
              <exclude>com/argodata/core/aspect/LastModifiedTime.class</exclude>
            </excludes>
          </instrumentation>
        </configuration>
      </plugin>

I'm not really sure why aspectJ was being re-invoked, but may spend some time later after this dev cycle is over to figure it out, and if I find anything I'll update the list.

Thanks,
Steve

On Tue, Jul 19, 2011 at 11:27 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Issues around Cobertura and AspectJ come up periodically on the list.

Are you building multiple modules?  It kind of looks like:
- aspectj built some code
- cobertura instrumented that code
- some other module was getting built that had a dependency on the first module, it had that first module on the aspect path and ajc tries to read the aspects from it.  It couldn't understand the aspects because their .class files had been partially rewritten by cobertura.

I guess it more needs a pipeline like this, if you are going to be using aspectpath:
- build all the code
- instrument all the code

If cobertura runs after AspectJ I can see no reason why you can't get some coverage for your aspects, but obviously you may have to interpret things in the report yourself as the aspect elements (like advice) will manifest as unusually named methods in the class file for the aspect, and cobertura won't be able to reverse map the name and tell which piece of advice it was created to represent.

Andy

On 18 July 2011 07:09, Steve Ash <stevemash@xxxxxxxxx> wrote:
Hello,

I recently plugged in Sonar into my build process.  This is probably a Sonar problem, but am curious if anyone in the aspectJ community has experienced this as well.  I am using Sonar's cobertura configuration (I have only taken defaults in Sonar), and strangely at some point in the process it seems to be invoking iajc against .class files that were already instrumented by cobertura?  I'm not sure why its doing that -- I would've assumed Cobertura would've run _after_ iajc.  In any case iajc blows up with:

l-2011 07:54:21 [ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.3.1:test-compile (default) on project argo-hibernate: Compiler errors:
18-Jul-2011 07:54:21 [ERROR] abort ABORT -- (RuntimeException) Problem processing attributes in /var/bamboo/xml-data/build-dir/JAVACORE-JAVACORETRUNK-JOB1/argo-hibernate/target/generated-classes/cobertura/com/argodata/core/aspect/CreatedTime.class
18-Jul-2011 07:54:21 [ERROR] Problem processing attributes in /var/bamboo/xml-data/build-dir/JAVACORE-JAVACORETRUNK-JOB1/argo-hibernate/target/generated-classes/cobertura/com/argodata/core/aspect/CreatedTime.class
18-Jul-2011 07:54:21 [ERROR] java.lang.RuntimeException: Problem processing attributes in /var/bamboo/xml-data/build-dir/JAVACORE-JAVACORETRUNK-JOB1/argo-hibernate/target/generated-classes/cobertura/com/argodata/core/aspect/CreatedTime.class
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelObjectType.ensureAspectJAttributesUnpacked(BcelObjectType.java:383)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelObjectType.<init>(BcelObjectType.java:160)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelWorld.buildBcelDelegate(BcelWorld.java:394)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelWorld.addSourceObjectType(BcelWorld.java:474)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelWorld.addSourceObjectType(BcelWorld.java:440)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelWeaver.isAspect(BcelWeaver.java:320)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelWeaver.addAspectsFromDirectory(BcelWeaver.java:299)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelWeaver.addLibraryJarFile(BcelWeaver.java:236)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld(AjBuildManager.java:864)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:245)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:181)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.tools.ajc.Main.run(Main.java:371)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.tools.ajc.Main.runMain(Main.java:248)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.mojo.aspectj.AbstractAjcCompiler.execute(AbstractAjcCompiler.java:370)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:85)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.maven3.Maven3PluginExecutor.concreteExecute(Maven3PluginExecutor.java:48)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:46)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:37)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.phases.InitializersExecutor.executeMavenPlugin(InitializersExecutor.java:67)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.phases.InitializersExecutor.execute(InitializersExecutor.java:54)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.phases.Phases.execute(Phases.java:77)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.ProjectBatch.execute(ProjectBatch.java:59)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.Batch.analyzeModule(Batch.java:164)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.Batch.analyzeModule(Batch.java:155)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.Batch.analyzeModules(Batch.java:82)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.batch.Batch.execute(Batch.java:62)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.maven3.SonarMojo.executeBatch(SonarMojo.java:148)
18-Jul-2011 07:54:21 [ERROR] at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:137)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
18-Jul-2011 07:54:21 [ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
18-Jul-2011 07:54:21 [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18-Jul-2011 07:54:21 [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
18-Jul-2011 07:54:21 [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
18-Jul-2011 07:54:21 [ERROR] at java.lang.reflect.Method.invoke(Method.java:597)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
18-Jul-2011 07:54:21 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
18-Jul-2011 07:54:21 [ERROR] Caused by: org.aspectj.weaver.BCException: malformed org.aspectj.weaver.Declare attribute (length:105)org.aspectj.weaver.BCException: Bad type signature parentTypes
18-Jul-2011 07:54:21 [ERROR] when batch building BuildConfig[null] #Files=7 AopXmls=#0
18-Jul-2011 07:54:21 [ERROR]
18-Jul-2011 07:54:21 [ERROR] when batch building BuildConfig[null] #Files=7 AopXmls=#0
18-Jul-2011 07:54:21 [ERROR]
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.AjAttribute.read(AjAttribute.java:137)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.Utility.readAjAttributes(Utility.java:101)
18-Jul-2011 07:54:21 [ERROR] at org.aspectj.weaver.bcel.BcelObjectType.ensureAspectJAttributesUnpacked(BcelObjectType.java:379)
18-Jul-2011 07:54:21 [ERROR] ... 65 more
18-Jul-2011 07:54:21 [ERROR] -> [Help 1]

Note that CreatedTime.class is an aspect -- not a normal java file.  So while it would be great to get coverage inside my aspects -- I'm not terribly concerned with that.  I am going to go down the path of trying to get cobertura to exclude the aspects.  In the meantime, I'm just curious if anyone has run across this as well.

Thanks,
Steve

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users