AspectJ Maven插件获取java.lang.NullPointerException

问题描述

我有121个班级的项目。我使用Maven进行编译。我首先使用lombok-maven-plugin生成代码,然后使用aspectj-maven-plugin进行编译和编织。

但是,当我尝试使用aspectj-maven-plugin进行编译时。但是,当“编译和编织”步骤出现时,我得到了:

[DEBUG] Compiling and weaving 121 sources to C:\eclipse\Dev01\foo\target\classes
[DEBUG] Arguments file written : C:\eclipse\Dev01\foo\target\classes\builddef.lst
[INFO] Showing AJC message detail for messages of types: [error,warning,fail]
[DEBUG] Pipelining compilation
[ERROR] Internal compiler error: java.lang.Exception: java.lang.NullPointerException at org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.Rounddispatcher.handleProcessor(Rounddispatcher.java:172)
    C:\eclipse\Dev01\foo\target\generated-sources\delombok\com\net\internet\foo\cc\menumobilecc\po\Bar.java:0
(no source information available)

[DEBUG] weaver operating in reweavable mode.  Need to verify any required types exist.

ajc命令行大约有40000个字符,看起来像这样:

ajc -XajruntiMetarget:1.5 -1.8 -encoding Cp1252 -showweaveInfo -source 1.8 -target 1.8 -verbose -classpath <allBuildpath> -d <allClassesInAbsolutPath>

这种编译工作适用于所有项目,但不适用于此项目。

    <build>
        <plugins>
            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>1.18.10.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <addOutputDirectory>false</addOutputDirectory>
                    <outputDirectory>${project.build.directory}/generated-sources/delombok</outputDirectory>
                    <sourceDirectory>src/main/java</sourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.11</version>
                <configuration>
                    <showweaveInfo>true</showweaveInfo>
                    <complianceLevel>1.8</complianceLevel>
                    <source>1.8</source>
                    <target>1.8</target>
                    <verbose>true</verbose>
                    <sources>
                        <source>
                            <basedir>${project.build.directory}/generated-sources/delombok</basedir>
                            <excludes>
                                <exclude>**\src\main\java\*</exclude>
                            </excludes>
                        </source>
                    </sources>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjtools</artifactId>
                        <version>1.9.2</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <packagingExcludes>**/.svn/</packagingExcludes>
                    <archive>
                    
                        <manifestEntries>
                            <Implementation-Title>${project.name}</Implementation-Title>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                    <warSourceDirectory>/WebContent</warSourceDirectory>
                    <webappDirectory>WebContent</webappDirectory>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${project.basedir}/WebContent/WEB-INF/lib</directory>
                        </fileset>
                        <fileset>
                            <directory>${project.basedir}/WebContent/WEB-INF/classes</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>pre-clean</id>
                        <phase>pre-clean</phase>
                        <configuration>
                            <target>
                                <delete dir="./target/test-classes" quiet="true" />
                                <delete dir="./target/generated-sources/delombok" quiet="true" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>install</id>
                        <phase>install</phase>
                        <configuration>
                            <target>
                                <delete dir="./target/test-classes" quiet="true" />
                                <delete dir="./target/generated-sources/delombok" quiet="true" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

如果有人可以救我?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)