Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AspectJ build #3282

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 70 additions & 27 deletions spring-data-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj}</version>
<scope>test</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -318,6 +317,39 @@
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<!--
To understand what this plugin execution does, please read
https://www.mojohaus.org/build-helper-maven-plugin/usage.html#set-a-property-according-to-whether-target-files-are-up-to-date
-->
<execution>
<id>set-antlr4-directory</id>
<goals>
<goal>uptodate-property</goal>
</goals>
<!-- Repeat default phase for clarity -->
<phase>validate</phase>
<configuration>
<name>antlr4.dir</name>
<value>antlr4-dummy</value>
<else>antlr4</else>
<fileSet>
<directory>${project.basedir}/src/main/antlr4</directory>
<outputDirectory>${project.build.directory}/generated-sources/antlr4</outputDirectory>
<mapper>
<type>glob</type>
<from>*.g4</from>
<to>*.interp</to>
</mapper>
</fileSet>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
Expand All @@ -330,30 +362,41 @@
<phase>generate-sources</phase>
<configuration>
<visitor>true</visitor>
<!-- Set source dir explicitly, either to default or to dummy value, the latter yielding 0 hits -->
<sourceDirectory>${project.basedir}/src/main/${antlr4.dir}</sourceDirectory>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.4.1</version>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<basedir>${project.build.directory}/generated-sources</basedir>
<includes>
<!-- Replace tokens in real or dummy directory, the latter yielding 0 hits -->
<include>${antlr4.dir}/**/*.java</include>
</includes>
<variableTokenValueMap>
public class=class,public interface=interface
</variableTokenValueMap>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<includes>
<include>target/generated-sources/antlr4/**/*.java</include>
</includes>
<variableTokenValueMap>
public class=class,public interface=interface
</variableTokenValueMap>
<proc>only</proc>
</configuration>
</plugin>

Expand All @@ -362,11 +405,6 @@
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14.0</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
Expand All @@ -375,32 +413,37 @@
</dependencies>
<executions>
<execution>
<id>aspectj-compile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>process-classes</phase>
<configuration>
</configuration>
</execution>
<execution>
<id>aspectj-test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<phase>process-test-classes</phase>
<configuration>
</configuration>
</execution>
</executions>
<configuration>
<!-- Annotation processing is done by Maven Compiler (hard to configure for AJ Maven) -->
<proc>none</proc>
<!-- Generate metadata for reflection on method parameters -->
<parameters>true</parameters>
<verbose>true</verbose>
<!--
To workaround:

- https://issues.apache.org/jira/browse/MCOMPILER-205
- https://issues.apache.org/jira/browse/MCOMPILER-209
- https://github.com/mojohaus/aspectj-maven-plugin/issues/15

-->
<forceAjcCompile>true</forceAjcCompile>
<showWeaveInfo>true</showWeaveInfo>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
<includes>
<include>**/domain/support/AuditingEntityListener.java</include>
</includes>
<complianceLevel>${source.level}</complianceLevel>
<source>${source.level}</source>
<target>${source.level}</target>
Expand Down