2016-05-30 9 views
1

MyEclipseで作られたSpring MVCアプリケーションは、生成されたソースだけでなく、独自のソースも含んでいます。 MyEclipseですべてのことがうまくコンパイルされましたが、今は継続的な統合サーバを使用するためにMavenに切り替える必要があります。maven aspectj weaving NullPointerException

私は長い間、pom.xmlを操作していましたが、私は周りを回っているようには見えません。 Mavenのは、織り側面の瞬間になると、私は次の例外(簡潔にするためだけの最初の数行)を取得:

[INFO] [aspectj:compile {execution: default}] 
[INFO] Showing AJC message detail for messages of types: [error, warning, fail] 
[ERROR] ABORT 
May 30, 2016 11:48:05 AM org.aspectj.weaver.tools.Jdk14Trace info 
INFO: Dumping to /var/atlassian/application-data/bamboo/xml-data/build-dir/OW-BUIL-JOB1/./ajcore.20160530.114805.876.txt 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] AJC compiler errors: 
abort ABORT -- (NullPointerException) null 
null 
java.lang.NullPointerException 
    at org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor.resolveAnnotations(AnnotationDiscoveryVisitor.java:238) 
    at org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor.visit(AnnotationDiscoveryVisitor.java:217) 
    at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1348) 
    at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:748) 
    ... 

を私のpom.xmlは、ここでそれを貼り付けるには長すぎるが、ビルド部分がようですその例外が発生する可能性があります間違っていたり欠けている何かを見

<build> 
    <directory>bin</directory> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>build-helper-maven-plugin</artifactId> 
      <version>1.7</version> 
      <executions> 
       <execution> 
        <id>add-source</id> 
        <phase>generate-sources</phase> 
        <goals> 
         <goal>add-source</goal> 
        </goals> 
        <configuration> 
         <sources> 
          <source>src</source> 
          <source>generated</source> 
          <source>resources</source> 
         </sources> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.1</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
       <excludes> 
        <exclude>main/</exclude> 
        <exclude>test/</exclude> 
       </excludes> 
       <useIncrementalCompilation>true</useIncrementalCompilation> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>aspectj-maven-plugin</artifactId> 
      <version>1.8</version> 
      <configuration> 
       <showWeaveInfo>true</showWeaveInfo> 
       <source>1.6</source> 
       <target>1.6</target> 
       <Xlint>ignore</Xlint> 
       <complianceLevel>1.6</complianceLevel> 
       <encoding>UTF-8</encoding> 
       <verbose>true</verbose> 
       <aspectLibraries> 
        <aspectLibrary> 
         <groupId>org.springframework</groupId> 
         <artifactId>spring-aspects</artifactId> 
        </aspectLibrary> 
       </aspectLibraries> 
      </configuration> 
      <executions> 
       <execution> 
        <phase>process-sources</phase> 
        <goals> 
         <goal>compile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <configuration> 
       <webXml>${project.basedir}/WebRoot/WEB-INF/web.xml</webXml> 
       <warName>oligoWorld</warName> 
       <outputDirectory>${project.basedir}</outputDirectory> 
      </configuration> 
     </plugin> 
    </plugins> 
    <pluginManagement> 
     <plugins> 
      <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> 
      <plugin> 
       <groupId>org.eclipse.m2e</groupId> 
       <artifactId>lifecycle-mapping</artifactId> 
       <version>1.0.0</version> 
       <configuration> 
        <lifecycleMappingMetadata> 
         <pluginExecutions> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId>org.codehaus.mojo</groupId> 
            <artifactId>aspectj-maven-plugin</artifactId> 
            <versionRange>[1.8,)</versionRange> 
            <goals> 
             <goal>compile</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <execute /> 
           </action> 
          </pluginExecution> 
         </pluginExecutions> 
        </lifecycleMappingMetadata> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 

誰:(あなたが依存関係のいくつかを見たい場合は私に知らせて)次の? FYI、私のaspectj依存関係(aspectjrt、aspectjtools、aspectjweaver)のバージョンは1.8.7です。

+0

これは役に立ちますか? http://stackoverflow.com/questions/11044213/internal-compiler-error-in-eclipse-npe –

+0

ありがとうございますが、実際はありません。 Eclipse内ではなく、継続的な統合サーバー(Bamboo)でコンパイルが行われているため、これらの手順は適用されません。 – timber

+0

解決策を以下の回答に移動する必要があります。 –

答えて

0

私はこの問題を発見したようです。 pom.xmlには、aspectj-maven-plugin定義外のpomファイルの依存関係セクションにある他のすべての依存関係とともにリストされたaspectjtoolsの依存関係がありました。代わりに、私はプラグインの中でそれを移動しました。また、aspectjライブラリのバージョンを1.8.9に変更しました。これは1.8.7が私が見つけたのと同じようなバグを示しているようです。この後、すべてがうまくいった。ですから、参考のためにaspectj-maven-pluginの定義を変更しました:

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>aspectj-maven-plugin</artifactId> 
      <version>1.8</version> 
      <dependencies> <!-- The change that fixed it starts here... --> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjtools</artifactId> 
        <version>1.8.9</version> 
       </dependency> 
      </dependencies> <!-- ...and ends here. --> 
      <configuration> 
       <showWeaveInfo>true</showWeaveInfo> 
       <source>1.6</source> 
       <target>1.6</target> 
       <Xlint>ignore</Xlint> 
       <complianceLevel>1.6</complianceLevel> 
       <encoding>UTF-8</encoding> 
       <verbose>true</verbose> 
       <aspectLibraries> 
        <aspectLibrary> 
         <groupId>org.springframework</groupId> 
         <artifactId>spring-aspects</artifactId> 
        </aspectLibrary> 
       </aspectLibraries> 
      </configuration> 
     </plugin>