java: Annotation processing is not supported for module cycles. Please ensure that all modules from cycle [jeecg-system-biz,jeecg-module-demo] are excluded from annotation processing
时间: 2023-10-25 15:25:56 浏览: 331
paoding-rose
这个错误通常是由于 Java 9 中新增的模块系统引起的。可能是因为你的项目中存在循环依赖,而循环依赖在模块系统中是不被允许的。解决这个问题的方法是将这些循环依赖的模块从注解处理中排除掉。你可以在 Maven 或 Gradle 的配置文件中添加以下代码:
Maven:
```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc7</version>
</path>
<path>
<groupId>com.squareup</groupId>
<artifactId>javapoet</artifactId>
<version>1.11.1</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
</compilerArgs>
<compilerArgs>
<arg>--add-modules=java.xml.bind</arg>
</compilerArgs>
<compilerArgs>
<arg>-AinheritedAnnotationClassNames=javax.persistence.Entity</arg>
</compilerArgs>
<compilerArgs>
<arg>-AinheritedAnnotationClassNames=javax.persistence.MappedSuperclass</arg>
</compilerArgs>
<compilerArgs>
<arg>-AinheritedAnnotationClassNames=javax.persistence.Embeddable</arg>
</compilerArgs>
<compilerArgs>
<arg>-AinheritedAnnotationClassNames=javax.persistence.EmbeddedId</arg>
</compilerArgs>
<compilerArgs>
<arg>-AinheritedAnnotationClassNames=javax.persistence.Id</arg>
</compilerArgs>
<compilerArgs>
<arg>-AinheritedAnnotationClassNames=javax.persistence.Version</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
```
Gradle:
```groovy
configurations {
compileOnly {
extendsFrom annotationProcessor
}
api {}
}
dependencies {
annotationProcessor 'com.google.auto.service:auto-service:1.0-rc7'
compileOnly 'com.google.auto.service:auto-service:1.0-rc7'
}
compileJava {
options.annotationProcessorPath = configurations.annotationProcessor
options.compilerArgs = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-modules=java.xml.bind",
"-AinheritedAnnotationClassNames=javax.persistence.Entity",
"-AinheritedAnnotationClassNames=javax.persistence.MappedSuperclass",
"-AinheritedAnnotationClassNames=javax.persistence.Embeddable",
"-AinheritedAnnotationClassNames=javax.persistence.EmbeddedId",
"-AinheritedAnnotationClassNames=javax.persistence.Id",
"-AinheritedAnnotationClassNames=javax.persistence.Version"
]
}
```
如果你使用的是其他的构建工具或 IDE,可以按照类似的方式进行配置。希望这能帮到你。
阅读全文