0

I've got a projet with 121 class. I use Maven to compile. I start by generate source with lombok-maven-plugin then i use aspectj-maven-plugin to compile and weave.

But, when I'm trying to compile with aspectj-maven-plugin. But when the step "Compiling and weaving" come I get :

[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.

The ajc command line is approximately 40000 characters along and it's look like this :

ajc -Xajruntimetarget:1.5 -1.8 -encoding Cp1252 -showWeaveInfo -source 1.8 -target 1.8 -verbose -classpath <allBuildPath> -d <allClassesInAbsolutPath>

This kind of compilation work for all projects but not for this one.

    <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>

If anybody can save me ?

  • This is an interesting question, but without an [MCVE](https://stackoverflow.com/help/mcve) (ideally on GitHub) I cannot say much because I have no way of reproducing your problem. My feeling is that somewhere you make something more complicated than necessary. Why would all classes be on your classpath instead of just directories or JAR archives? Why do you need AntRun for cleaning up your directories? This looks a bit contrived. BTW, is it related to your [other question](https://stackoverflow.com/questions/63724015/exclude-src-main-java-from-compiling-with-maven-compiler-plugin)? – kriegaex Sep 05 '20 at 03:57
  • Thanks for helping me. I can't produce a MCVE, 'cause I don't know where does the problem come from. And I can't give you sources. That sad I know :/. If nobody can help me just with this clues, I'm gonna put my solution when I find some. – Joffrey Leblay Sep 07 '20 at 09:06
  • The way you usually create an MCVE is by taking the original and removing pieces bit by bit, until you have the smallest version still reproducing the error. Doing this also helps you to learn about the problem as a side effect. Then optionally you rename classes and package names to dummy names, so I cannot recognise the original code anymore. An IDE should help you do this fairly quickly. There is always a way to create an MCVE if you really want to. You are a developer! You can even put it into a private GitHub repo and share it only with me. Use your imagination! – kriegaex Sep 07 '20 at 10:04

0 Answers0