0

我有一个基于annotations的自定义安全框架。当它遇到方法的安全注释时,我使用aspectj maven插件来编织方面。Junit因Aspect失败

我使用jenkins来构建项目,而aspectj maven插件的目标是为编译设置的,如下所示。

<plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>aspectj-maven-plugin</artifactId> 
      <version>1.4</version> 
      <dependencies> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjrt</artifactId> 
        <version>1.6.5</version> 
       </dependency> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjtools</artifactId> 
        <version>1.6.5</version> 
       </dependency> 
      </dependencies> 
      <configuration> 
       <showWeaveInfo>true</showWeaveInfo> 
       <complianceLevel>1.6</complianceLevel> 
       <!-- <weaveDirectories> <weaveDirectory>${project.build.directory}/classes</weaveDirectory> 
        </weaveDirectories> --> 
      </configuration> 
      <executions> 
       <execution> 
        <!-- Compile and weave aspects after all classes compiled by javac --> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>compile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

问题是当JUnit的runs.Since就已经编织相关的方法注释的安全性,单元测试失败。

有没有一种方法可以让联合工作,然后进行纵向编织? 因为我单独使用.aj文件,所以我不确定如何设置加载时间编织。

对此的任何帮助表示赞赏。

Regards

回答

0

我改组我的Maven目标为

干净编译测试的AspectJ:这样做这是所有我想要测试AspectJ织编译后

0

我想你需要添加test-compile到你的目标。

<goals> 
    <goal>compile</goal> 
    <goal>test-compile</goal> 
</goals>