Maven 2 maven cobertura报告aspectj为0%
有人能够将maven2与Aspectj插件和Cobertura插件一起使用吗?当我应该得到一些东西时,我一直得到0%的保险。Cobertura仪器在Aspectj编织之前运行,我认为这会弄乱Cobertura仪器。此外,Cobertura正在就我的方面发出警告,看起来它正试图将它们解析为java文件。任何帮助都将不胜感激 C:\project>mvn cobertura:cobertura [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Project [INFO] task-segment: [cobertura:cobertura] [INFO] ------------------------------------------------------------------------ [INFO] Preparing cobertura:cobertura [INFO] [aspectj:compile {execution: compile}] [INFO] [resources:resources] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [cobertura:instrument] [INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file Cobertura: Loaded information on 538 classes. Instrumenting 538 files to C:\project\target\generated-classes\cobertura Cobertura: Saved information on 538 classes. Instrument time: 3938ms [INFO] Instrumentation was successful. [INFO] [aspectj:test-compile {execution: test-compile}] [INFO] [resources:testResources] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [compiler:testCompile] [INFO] Nothing to compile - all classes are up to date [INFO] [surefire:test] [INFO] Surefire report directory: C:\project\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running project.AnnounceTypeActionTest Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.594 sec Results : Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 [INFO] [cobertura:cobertura] [INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file Cobertura: Loaded information on 538 classes. Javancss.(InputStream).e: net.sourceforge.cobertura.javancss.ParseException: Encountered "aspect" at line 5, column 8. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... [cobertura] WARN [main] net.sourceforge.cobertura.reporting.ComplexityCalculator - JavaNCSS got an error while parsing the java file C:\project\src\main\java\Project\logging\ApplicationLoggingAspect.aj ParseException in STDIN Last useful checkpoint: "project.logging." Encountered "aspect" at line 5, column 8. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... Javancss.(InputStream).e: net.sourceforge.cobertura.javancss.ParseException: Encountered "aspect" at line 4, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... [cobertura] WARN [main] net.sourceforge.cobertura.reporting.ComplexityCalculator - JavaNCSS got an error while parsing the java file C:\project\src\main\java\Project\logging\LoggingAspect.aj ParseException in STDIN Last useful checkpoint: "project.logging." Encountered "aspect" at line 4, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... Javancss.(InputStream).e: net.sourceforge.cobertura.javancss.ParseException: Encountered "aspect" at line 6, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... [cobertura] WARN [main] net.sourceforge.cobertura.reporting.ComplexityCalculator - JavaNCSS got an error while parsing the java file C:\project\src\main\java\Project\logging\TracingAspect.aj ParseException in STDIN Last useful checkpoint: "project.logging." Encountered "aspect" at line 6, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... Report time: 5891ms [INFO] Cobertura Report generation was successful. [INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file Cobertura: Loaded information on 538 classes. Javancss.(InputStream).e: net.sourceforge.cobertura.javancss.ParseException: Encountered "aspect" at line 5, column 8. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... [cobertura] WARN [main] net.sourceforge.cobertura.reporting.ComplexityCalculator - JavaNCSS got an error while parsing the java file C:\project\src\main\java\Project\logging\ApplicationLoggingAspect.aj ParseException in STDIN Last useful checkpoint: "project.logging." Encountered "aspect" at line 5, column 8. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... Javancss.(InputStream).e: net.sourceforge.cobertura.javancss.ParseException: Encountered "aspect" at line 4, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... [cobertura] WARN [main] net.sourceforge.cobertura.reporting.ComplexityCalculator - JavaNCSS got an error while parsing the java file C:\project\src\main\java\Project\logging\LoggingAspect.aj ParseException in STDIN Last useful checkpoint: "project.logging." Encountered "aspect" at line 4, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... Javancss.(InputStream).e: net.sourceforge.cobertura.javancss.ParseException: Encountered "aspect" at line 6, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... [cobertura] WARN [main] net.sourceforge.cobertura.reporting.ComplexityCalculator - JavaNCSS got an error while parsing the java file C:\project\src\main\java\Project\logging\TracingAspect.aj ParseException in STDIN Last useful checkpoint: "project.logging." Encountered "aspect" at line 6, column 17. Was expecting one of: "@" ... "abstract" ... "final" ... "public" ... "synchronized" ... "strictfp" ... "class" ... "static" ... "protected" ... "private" ... "native" ... "transient" ... "volatile" ... "enum" ... "interface" ... Report time: 3125ms [INFO] Cobertura Report generation was successful. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 30 seconds [INFO] Finished at: Wed Sep 02 17:15:45 VET 2009 [INFO] Final Memory: 26M/254M [INFO] ------------------------------------------------------------------------ C:\project>mvn cobertura:cobertura [信息]正在扫描项目。。。 [信息]------------------------------------------------------------------------ [信息]建筑工程 [信息]任务段:[cobertura:cobertura] [信息]------------------------------------------------------------------------ [信息]准备cobertura:cobertura [INFO][aspectj:compile{execution:compile}] [信息][参考资料:参考资料] [信息]使用“UTF-8”编码复制筛选的资源。 [信息]正在复制1个资源 [信息][编译:编译] [信息]无需编译-所有类都是最新的 [信息][科贝图拉:仪器] [信息]Cobertura 1.9.2-GNU GPL许可证(无担保)-参见版权文件 Cobertura:加载了538个类的信息。 将538个文件检测到C:\project\target\generated classes\cobertura Cobertura:保存了538个类的信息。 仪器时间:3938ms [信息]检测成功。 [INFO][aspectj:testcompile{execution:testcompile}] [信息][参考资料:testResources] [信息]使用“UTF-8”编码复制筛选的资源。 [信息]正在复制1个资源 [信息][编译器:testCompile] [信息]无需编译-所有类都是最新的 [信息][surefire:测试] [信息]Surefire报告目录:C:\project\target\Surefire报告 ------------------------------------------------------- T T S T S ------------------------------------------------------- 正在运行project.typeActionTest 测试运行:3,失败:0,错误:0,跳过:0,所用时间:0.594秒 结果: 测试运行:3,失败:0,错误:0,跳过:0 [信息][科贝图拉:科贝图拉] [信息]Cobertura 1.9.2-GNU GPL许可证(无担保)-参见版权文件 Cobertura:加载了538个类的信息。 Javancss.(InputStream).e:net.sourceforge.cobertura.Javancss.ParseException:在第5行第8列遇到“方面”。 我期待的是: "@" ... “摘要”。。。 “决赛”。。。 “公众”。。。 “同步的”。。。 “严格的FP”。。。 “阶级”。。。 “静态”。。。 “受保护”。。。 “私人”。。。 “本地人”。。。 “暂时的”。。。 “挥发性”。。。 “枚举”。。。 “接口”。。。 [cobertura]WARN[main]net.sourceforge.cobertura.reporting.ComplexityCalculator-JavaNCSS在分析java文件C:\project\src\main\java\project\logging\applicationloggingapect.aj时出错 STDIN中的ParseException 最后一个有用的检查点:“project.logging” 在第5行第8列遇到“方面”。 我期待的是: "@" ... “摘要”。。。 “决赛”。。。 “公众”。。。 “同步的”。。。 “严格的FP”。。。 “阶级”。。。 “静态”。。。 “受保护”。。。 “私人”。。。 “本地人”。。。 “暂时的”。。。 “挥发性”。。。 “枚举”。。。 “接口”。。。 Javancss.(InputStream).e:net.sourceforge.cobertura.Javancss.ParseException:在第4行第17列遇到“方面”。 我期待的是: "@" ... “摘要”。。。 “决赛”。。。 “公众”。。。 “同步的”。。。 “严格的FP”。。。 “阶级”。。。 “静态”。。。 “受保护”。。。 “私人”。。。 “本地人”。。。 “暂时的”。。。 “挥发性”。。。 “枚举”。。。 “接口”。。。 [cobertura]WARN[main]net.sourceforge.cobertura.reporting.ComplexityCalculator-JavaNCSS在解析java文件C:\project\src\main\java\project\LoggingAspect.aj时出错 STDIN中的ParseException 最后一个有用的检查点:“project.logging” 在第4行第17列遇到“方面”。 我期待的是: "@" ... “摘要”。。。 “决赛”。。。 “公众”。。。 “同步的”。。。 “严格的FP”。。。 “阶级”。。。 “静态”。。。 “受保护”。。。 “私人”。。。 “本地人”。。。 “暂时的”。。。 “挥发性”。。。 “枚举”。。。 “接口”。。。 Javancss.(InputStream).e:net.sourceforge.cobertura.Javancss.ParseException:在第6行第17列遇到“方面”。 我期待的是: "@" ... “摘要”。。。 “决赛”。。。 “公众”。。。 “同步的”。。。 “严格的FP”。。。 “阶级”。。。 “静态”。。。 “受保护”。。。 “私人”。。。 “本地人”。。。 “暂时的”。。。 “挥发性”。。。 “枚举”。。。 “接口”。。。 [cobertura]WARN[main]net.sourceforge.cobertura.reporting.ComplexityCalculator-JavaNCSS在分析java文件C:\project\src\main\java\project\logging\TracingAspect.aj时出错 STDIN中的ParseException 最后一个有用的检查点:“project.logging” 在第6行第17列遇到“方面”。 我期待的是: "@" ... “摘要”。。。 “决赛”。。。 “公众”。。。 “同步的”。。。 “严格的FP”。。。 “阶级”。。。 “静态”。。。 “受保护”。。。 “私人”。。。 “本地人”。。。 “暂时的”。。。 “挥发性”。。。 “枚举”。。。 “接口”。。。 报告时间:5891毫秒 [信息]已成功生成Cobertura报告。 [信息]Cobertura 1.9.2-GNU GPL许可证(无担保)-参见版权文件 Cobertura:加载了538个类的信息。 Javancss.(InputStream).e:net.sourceforge.cobertura.Javancss.ParseException:在第5行第8列遇到“方面”。 我期待的是: "@" ... “摘要”。。。 “决赛”。。。 “公众”。。。 “同步的”。。。 “严格的FP”。。。 “阶级”。。。 “静态”。。。 “受保护”。。。 “私人”。。。 “本地人”。。。 “暂时的”。。。 “挥发性”。。。 “枚举”。。。 “接口”。。。 [cobertura]WARN[main]net.sourceforge.cobertura.reporting.ComplexityCalculator-JavaNCSS在分析java文件C:\project\src\main\java\project\logging\applicationloggingapect.aj时出错 STDIN中的ParseException 最后的uMaven 2 maven cobertura报告aspectj为0%,maven-2,maven-plugin,aspectj,cobertura,Maven 2,Maven Plugin,Aspectj,Cobertura,有人能够将maven2与Aspectj插件和Cobertura插件一起使用吗?当我应该得到一些东西时,我一直得到0%的保险。Cobertura仪器在Aspectj编织之前运行,我认为这会弄乱Cobertura仪器。此外,Cobertura正在就我的方面发出警告,看起来它正试图将它们解析为java文件。任何帮助都将不胜感激 C:\project>mvn cobertura:cobertura [INFO] Scanning for projects... [INFO] --------------
[INFO] Preparing surefire-report:report
[INFO] [aspectj:compile {execution: compile_with_aspectj}]
...
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
...
[INFO] [compiler:testCompile {execution: test-compile}]
[INFO] Compiling 8 source files to C:\test\aop-test
[INFO] [aspectj:test-compile {execution: test-compile_with_aspectj}]
...
[INFO] [surefire:test]
...
[INFO] Preparing cobertura:cobertura
[INFO] [aspectj:compile {execution: compile_with_aspectj}]
...
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [cobertura:instrument]
[INFO] Cobertura 1.8 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 11 files to C:\test\aop-test\generated-classes\cobertura
Cobertura: Saved information on 11 classes.
Instrument time: 250ms
[INFO] Instrumentation was successful.
[INFO] [compiler:testCompile {execution: test-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [aspectj:test-compile {execution: test-compile_with_aspectj}]
...
[INFO] [surefire:test]
...
Cobertura: Coverage data file C:\test\aop-test\cobertura.ser either
does not exist or is not readable. Creating a new data file.
Cobertura: Saved information on 8 classes.
before(Throwable e, Object subject): handlers(e, subject) {
Log logger = getTraceLog(subject.getClass());
//code to trace exception handling
...
}
before(Throwable e, Object subject): handlers(e, subject) {
Log logger = getTraceLog(subject.getClass());
//get helper type and delegate processing to that type.
getFormatterHelper().traceErrorHandling(logger, thisJoinPoint, e);
}
<build>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>compile_with_aspectj</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<complianceLevel>1.5</complianceLevel>
</configuration>
</execution>
<execution>
<id>test-compile_with_aspectj</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<complianceLevel>1.5</complianceLevel>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
...
<reporting>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<outputDirectory>target/site/cobertura</outputDirectory>
</configuration>
</plugin>
<plugins
</reporting>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test-compile</goal> -->
</goals>
</execution>
</executions>
<configuration>
<source>1.6</source>
<weaveWithAspectsInMainSourceFolder>true</weaveWithAspectsInMainSourceFolder>
<weaveMainSourceFolder>true</weaveMainSourceFolder>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
<configuration>
<formats>
<format>xml</format>
</formats>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
</plugin>