英文:
Maven compiler plugin not copying generated classes to test-sources
问题
以下是您要翻译的内容:
Maven编译插件未将生成的类(来自mapstruct的映射器)复制到target\generated-test-sources\test-annotations目录中。该目录已创建,但为空。生成的类只复制到target\generated-sources\annotations目录中。
这是我的maven-compiler插件配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
谢谢!
英文:
Maven compiler plugin is not copying the generated classes(mappers from mapstruct) to target\generated-test-sources\test-annotations. The directory is created but it's empty. The generated classes are copied to target\generated-sources\annotations only.
This is my maven-compiler plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Thank you!
答案1
得分: 1
生成的源代码位置由maven-compiler-plugin定义。
默认情况下,它会将注解处理器生成的类放在:
- target/generated-sources/annotations - 当从
src/main/java
位置编译类时 - target/generated-test-sources/test-annotations - 当从
src/test/java
位置编译类时
为了使您能够在target/generated-test-sources/test-annotations
下看到类,您的映射器应该位于src/test/java
下。
英文:
The location of the generated source is defined by the maven-compiler-plugin.
By default it will put classes generated by annotation processor in:
- target/generated-sources/annotations - When compiling classes from the
src/main/java
location - target/generated-test-sources/test-annotations - When compiling clases from the
src/test/java
location
In order for you to see the classes under target/generated-test-sources/test-annotations
then your mappers should be under src/test/java
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论