2011-09-15 2 views
1

Java 6.0을 사용하여 maven 프로젝트에 aspectj를 추가하려고합니다. 1.4 버전의 aspectj-maven-plugin과 1.6.11 버전의 aspectj를 사용합니다.런타임 중에 aspect가 발견되지 않습니다

클래스는 외부 의존성 항아리에 있고 여기에 치어입니다 :

양상이 보인다
<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>aspectj-maven-plugin</artifactId> 
    <configuration> 
     <complianceLevel>1.6</complianceLevel> 
     <source>1.6</source> 
     <target>1.6</target>   
     <showWeaveInfo>true</showWeaveInfo> 
     <weaveDependencies> 
     <weaveDependency> 
      <groupId>${project.groupId}</groupId> 
      <artifactId>gem</artifactId> 
     </weaveDependency> 
     </weaveDependencies>   
    </configuration> 
    <executions> 
     <execution> 
     <!-- Needs to run before the regular javac compile phase --> 
     <phase>process-sources</phase> 
     <goals> 
      <goal>compile</goal> 
     </goals> 
     </execution> 
    </executions> 
    </plugin> 

빌드 시간 동안 잘 적용되는 : 여기 는 샘플입니다

[INFO] --- aspectj-maven-plugin:1.4:compile (default) @ test --- 
[INFO] Extending interface set for type 'test.pkg1.pkg2.PaymentEnquiry' (PaymentE 
nquiry.java) to include 'test.pkg1.pkg2.aj.AdditionalPaymentEnquiryMethods'  
(PaymentEnquiryExtensions.aj) 

그러나 런타임 중에 다음 오류가 발생합니다. java.lang.NoSuchMethodError :
test.pkg1.pkg2.Payment.setDetails (Ljava/util/List;) V

왜 이런 일이 발생했는지에 대한 아이디어가 가장 도움이 될 것입니다.

+0

수정 된 클래스 파일은 어디에 있습니까? 코드를 실행할 때 classpath에 확장되지 않은 클래스 대신 포함 된 클래스를 포함 하시겠습니까? –

답변

0

가장 확실한 이유는 서명 test.pkg1.pkg2.Payment에

void setDetails(List) 

아무런 방법이 없다는 것입니다. 그것은 AspectJ 문제와 같지 않다. 런타임에 클래스 패스 문제에 관한 잘못된 코드가 더 많다.