나는 광범위하게 검색하여 내 문제를 해결하는 데 도움이되는 것을 찾지 못했습니다. 나는 특정 기능을 구현하기 위해 노력하고 내가 의한 PoC 솔루션을 생성하고, 여기에 비록 문제 :한 프로젝트에서 Aspectj 컴파일 시간 짜기 및 Java 컴파일 타임 주석 처리 사용
은 컴파일 시간을 모두 사용하는 것은 AspectJ를을 직조 및 시간 주석 프로세서를
를 컴파일하고 난 몰라 그 두 가지 작업을 동시에 수행하는 방법.
지금까지 aspectj-maven-plugin을 사용하여 * .aj 파일에서 AspectJ aspect만을 사용하고 있었고 정상적으로 작동하고있었습니다. maven-compiler-plugin을 사용하여 주석 처리를 추가하자마자 문제가 발생했습니다 : aspectj-maven-plugin에 의해 컴파일 단계에서 생성 된 대상 디렉토리의 weaved 클래스가 maven-compiler-plugin에 의해 덮어 쓰여졌습니다 그것은 컴파일 단계에서 생성 된 클래스에 의해 수행됩니다.
[INFO] --- aspectj-maven-plugin:1.10:compile (default) @ demo ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
...and a list of all the Join Points and Intertypes done
그러나 받는다는 - 컴파일러 플러그인이 일을하러 모든 것을 다시 컴파일 (와 클래스를 생성
콘솔 출력은 먼저 AspectJ를-받는다는 - 플러그인은이 작업의 수행과 모든 클래스를 엮어 말한다 주석 처리기)로 :
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
<includes>
<include>
path/to/annotation/processor/Processor.java
</include>
</includes>
</configuration>
</execution>
<execution>
<id>compile-project</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.10</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<complianceLevel>${maven.compiler.source}</complianceLevel>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
: 여기
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to dir\demo\target\classes
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (compile-project) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 19 source files to dir\demo\target\classes
는 pom.xml 파일의 관련 부분은
별도로 aspect와 annotation processor가 모두 잘 작동하므로 특별히 문제가되지 않습니다. 문제는 빌드 구성이라고 가정합니다.
나는 플러그인에서 실행/단계로 뭔가를 망쳐 놓고있는 것 같아요, 아니면 둘 다 사용하지 않아도 될 것입니다. 어쩌면 하나만으로 충분할 수도 있지만, 컴파일을 ajc와 결합하고 주석 처리기를 실행하는 방법에 대해서는 전혀 알지 못합니다. (그리고 주석 처리기 자체를 컴파일하고 주석 처리를 수행하는 데는 proc 없음을 먼저 사용합니다. 도와주세요!