IntelliJ IDEA micronaut-openapi javac 注释处理器在 IntelliJ 目录中搜索 openapi.properties
IntelliJ IDEA micronaut-openapi javac annotation processor searching in IntelliJ directory for openapi.properties
我正在使用 Micronaut OpenAPI 模块并面临一个问题,即默认值 openapi.properties
在 IntelliJ 中未正确处理。在命令行上进行编译工作。在分析注解模块时发现它在IntelliJ相关目录C:\Users\<username>\AppData\Local\JetBrains\IntelliJIdea2020.1\compile-server
目录中查找,显然没有找到。这可以防止使用 openapi.properties
中的配置选项。似乎无法将 IntelliJ 配置为使用项目目录作为注释处理器的工作目录。
Micronaut 提供系统 属性 配置选项 micronaut.openapi.config.file
。这可以使用 pom.xml
文件作为系统变量传递给注释处理器。 IntelliJ 会选择这个。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
...
<path>
<groupId>io.micronaut.configuration</groupId>
<artifactId>micronaut-openapi</artifactId>
<version>use most recent version</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
...
<arg>-Amicronaut.openapi.config.file=${project.basedir}/openapi.properties</arg>
...
</compilerArgs>
...
对于基于 Gradle 的项目,类似的机制应该是可能的。
我正在使用 Micronaut OpenAPI 模块并面临一个问题,即默认值 openapi.properties
在 IntelliJ 中未正确处理。在命令行上进行编译工作。在分析注解模块时发现它在IntelliJ相关目录C:\Users\<username>\AppData\Local\JetBrains\IntelliJIdea2020.1\compile-server
目录中查找,显然没有找到。这可以防止使用 openapi.properties
中的配置选项。似乎无法将 IntelliJ 配置为使用项目目录作为注释处理器的工作目录。
Micronaut 提供系统 属性 配置选项 micronaut.openapi.config.file
。这可以使用 pom.xml
文件作为系统变量传递给注释处理器。 IntelliJ 会选择这个。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
...
<path>
<groupId>io.micronaut.configuration</groupId>
<artifactId>micronaut-openapi</artifactId>
<version>use most recent version</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
...
<arg>-Amicronaut.openapi.config.file=${project.basedir}/openapi.properties</arg>
...
</compilerArgs>
...
对于基于 Gradle 的项目,类似的机制应该是可能的。