2011-02-16 61 views
1

當我試圖將我的方面編織到我的應用程序中時,我使用了aspectj-maven-plugin。我看到的問題是,編譯和編織似乎運行良好,但每當它進入測試階段時,它就會掛起。我已經包括了從我的pom.xml節maven和aspectj插件 - 測試掛起

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>aspectj-maven-plugin</artifactId> 
      <version>1.3</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
      <executions> 
       <execution> 
        <goals> 
         <goal>compile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

<dependencies> 
    <dependency> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>1.2.16</version> 
    </dependency> 
    <dependency> 
     <groupId>org.aspectj</groupId> 
     <artifactId>aspectjrt</artifactId> 
     <version>1.6.7</version> 
    </dependency> 
</dependencies> 

這是輸出我得到:

[INFO] Compiling 7 source files to /home/***/target/classes 
[INFO] [aspectj:compile {execution: default}] 
[INFO] [resources:testResources {execution: default-testResources}] 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /home/***/src/test/resources 
[INFO] [compiler:testCompile {execution: default-testCompile}] 
[INFO] Compiling 5 source files to /home/***/target/test-classes 
[INFO] [aspectj:test-compile {execution: default}] 
[INFO] [surefire:test {execution: default-test}] 
[INFO] Surefire report directory: /home/***/surefire-reports 

------------------------------------------------------- 
    T E S T S 
------------------------------------------------------- 
Running com.example.MyTest 

有其他人看到這種行爲/知道如何解決它?

回答

2

把這個放在這裏是爲了防止有人像我一樣做。測試掛起的原因是因爲方面切入點。

call(* *.*(..)) 

之後,我得到了一個在切入點之前被調用的建議。然而,這創造了一個循環條件,並懸掛我的測試。衛生署!