1

第一个问题:Mapstruct 生成代码以定位具有标记“派生”的注释文件夹。RTC 忽略了这一点,因此我无法签入生成的代码(不要问我为什么要这样做 - 我需要它)。是否有机会禁用 gen-folder 上的派生标记,以便可以将生成的类 (.java) 检入存储库?第二个问题: Mapstruct 类应该在我的本地机器上生成,而不是在构建服务器上。如何配置 maven 仅在本地执行?

先感谢您。

目前我的 pom.xml 看起来像这样,因为我无法按照我需要的方式配置它:

<plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <generatedSourcesDirectory>gen</generatedSourcesDirectory>
                <annotationProcessorPaths>
                    <path>
                        <groupId>de.......</groupId>
                        <artifactId>mapstruct_config</artifactId>
                        <version>${config.version}</version>
                    </path>
                    <path>
                        <groupId>org.mapstruct</groupId>
                        <artifactId>mapstruct-processor</artifactId>
                        <version>${org.mapstruct.version}</version>
                    </path>
                </annotationProcessorPaths>
                <compilerArgs>
                    <compilerArg>
                        -Amapstruct.suppressGeneratorTimestamp=true
                    </compilerArg>
                    <compilerArg>
                        -Amapstruct.suppressGeneratorVersionInfoComment=true
                    </compilerArg>
                    <compilerArg>
                        -Amapstruct.unmappedTargetPolicy=WARN
                    </compilerArg>
                </compilerArgs>
            </configuration>
        </plugin>

1:gen 文件夹没有派生标记 2:annotationProcessor 仅在本地机器上工作

4

1 回答 1

0

我认为衍生标记来自 Eclipse(IntelliJ 也这样做)。很可能你必须在你的 IDE 中手动禁用它,不确定它是否总是像通常从 Maven 本身应用这些位置一样工作。

为了使注释处理器仅在本地运行,我认为您需要添加一个自定义 maven 配置文件,您将在其中配置annotationProcessorPaths,默认配置文件(在 CI 上)将没有annotationProcessorPaths,因此不会运行注释处理

于 2019-05-03T19:06:33.897 回答