mojohaus / aspectj-maven-plugin

https://www.mojohaus.org/aspectj-maven-plugin/
MIT License
114 stars 72 forks source link

Support for Java 14 & 16 #97

Closed CyborTronik closed 3 years ago

CyborTronik commented 3 years ago

Seems that java tools jar has been changed in latest versions of jvm. This plugin or one of it's dependencies tries to use it directly (by the path). Getting the next error:

[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile (default) on project javatar: Execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile failed: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.11 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:14.0.2 at specified path /home/stanislav/.jabba/jdk/zulu@1.14.0/../lib/tools.jar -> [Help 1]
CyborTronik commented 3 years ago

Looks like this works in the latest snapshot version, had to add <complianceLevel>14</complianceLevel>. The full config can be found below:

   <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>${aspectj-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <complianceLevel>${maven.compiler.source}</complianceLevel>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjtools</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
kriegaex commented 3 years ago

Version 1.11 does not work on JDK 9+, see this short recap of the project history over the last few years. Other people - me included - were forced to fork the plugin. But after a few years of inactivity, now the Mojohaus version is being maintained again and a release probably is not far in the future, maybe as soon as a couple of weeks according to one of the maintainers. If you need a stable non-snapshot which also supports Java 8-16, use the AspectJ.dev variant (dev.aspectj:aspectj-maven-plugin:1.13.M3) for now. That version still has a few more features, but basically the two are identical, and we are working on getting them merged back in here. If you do not mind the snapshot, just stick with the Mojohaus version.

olamy commented 3 years ago

fixed with next version 1.14.0

CyborTronik commented 3 years ago

Thank you @olamy