使用 EMMA 编译失败

发布于 2024-12-29 06:38:05 字数 2315 浏览 4 评论 0原文

我想将 emma 报告添加到 Maven 项目中,我已经在 pom 中配置了插件:

<plugins>     
  <plugin>      
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>emma-maven-plugin</artifactId>
    <version>1.0-alpha-3</version>
    <inherited>true</inherited>          
    <executions>
      <execution>
        <phase>process-classes</phase>               
        <goals>
          <goal>instrument</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <inherited>true</inherited>
    <configuration>
      <forkMode>once</forkMode>
      <reportFormat>xml</reportFormat>
      <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>    
    </configuration>        
  </plugin>
</plugins>

当我运行时 mvn clean install

我收到以下错误

[INFO] Compiling 58 source files to target/test-classes
 INFO] -------------------------------------------------------------
 [ERROR] COMPILATION ERROR : 
 [INFO] -------------------------------------------------------------
 [ERROR]  src/test/java/project/testframework/junit/support/SupportInvoker.java:[80,21] cannot access org.springframework.core.env.EnvironmentCapable
 class file for org.springframework.core.env.EnvironmentCapable not found
                                    supports.add(ctx.getBean(support));
 [ERROR] src/test/java/project/testframework/mockwebcontext/MockWebApplicationContextLoader.java:[37,72] cannot access org.springframework.beans.factory.Aware
 class file for org.springframework.beans.factory.Aware not found
                            final DispatcherServlet dispatcherServlet = new DispatcherServlet() {
 [ERROR] src/test/java/project/testframework/mockwebcontext/MockWebApplicationContextLoader.java:[38,24] method does not override or implement a method from a supertype

当我在没有 emma 的情况下运行 mvn clean install 时,一切正常,没有任何错误。 我可以使用 eclipse 插件运行 emma,它也能工作,但我无法从 Maven 获得 emma 工作。

有什么想法吗?

I want to add emma reports into the maven project I have configured the plugin in pom :

<plugins>     
  <plugin>      
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>emma-maven-plugin</artifactId>
    <version>1.0-alpha-3</version>
    <inherited>true</inherited>          
    <executions>
      <execution>
        <phase>process-classes</phase>               
        <goals>
          <goal>instrument</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <inherited>true</inherited>
    <configuration>
      <forkMode>once</forkMode>
      <reportFormat>xml</reportFormat>
      <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>    
    </configuration>        
  </plugin>
</plugins>

and when I run
mvn clean install

I get following error

[INFO] Compiling 58 source files to target/test-classes
 INFO] -------------------------------------------------------------
 [ERROR] COMPILATION ERROR : 
 [INFO] -------------------------------------------------------------
 [ERROR]  src/test/java/project/testframework/junit/support/SupportInvoker.java:[80,21] cannot access org.springframework.core.env.EnvironmentCapable
 class file for org.springframework.core.env.EnvironmentCapable not found
                                    supports.add(ctx.getBean(support));
 [ERROR] src/test/java/project/testframework/mockwebcontext/MockWebApplicationContextLoader.java:[37,72] cannot access org.springframework.beans.factory.Aware
 class file for org.springframework.beans.factory.Aware not found
                            final DispatcherServlet dispatcherServlet = new DispatcherServlet() {
 [ERROR] src/test/java/project/testframework/mockwebcontext/MockWebApplicationContextLoader.java:[38,24] method does not override or implement a method from a supertype

When I run mvn clean install without emma everything works without any errors.
I can run emma using eclipse plugin and it works as well but I can't get emma work from maven.

Any Ideas ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文