注释处理:最终jar中缺少生成的源

问题描述

我有一个注释处理器,可以在其中生成一些.java文件

target / generated-sources /'

但是最终的jar缺少这些文件。

这是我的pom.xml:

<build>
    <plugins>

        <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.8.1</version>

            <configuration>
                <generatedSourcesDirectory>${project.build.directory}/generated-sources/</generatedSourcesDirectory>
            </configuration>

            <executions>
                <execution>
                    <id>process-annotations</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                    <configuration>
                        <proc>only</proc>
                        <annotationProcessors>
                            <annotationProcessor>com.example.demo.processor.AcordMappingProcessor
                            </annotationProcessor>
                        </annotationProcessors>
                    </configuration>
                </execution>
                <execution>
                    <id>default-compile</id>
                    <configuration>
                        <proc>none</proc>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

我在这里做错了什么?尝试添加build-helper-maven-plugin,但没有任何反应。

<plugin>
     <groupId>org.codehaus.mojo</groupId>
          <artifctId>build-helper-maven-plugin</artifactId>
          <version>3.2.0</version>
          <executions>
               <execution>
                   <id>add-source</id>
                   <phase>generate-sources</phase>
                   <goals>
                       <goal>add-source</goal>
                   </goals>
                   <configuration>
                       <sources>
                           <source>${project.build.directory}/generated-sources</source>
                       </sources>
                   </configuration>
             </execution>
       </executions>
</plugin>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...