gpt4 book ai didi

java - 将生成的构建文件添加到类路径

转载 作者:搜寻专家 更新时间:2023-10-31 19:48:40 27 4
gpt4 key购买 nike

在构建过程中,我通过包含构建信息的 Maven 属性插件 (properties-maven-plugin) 生成了一个 build.properties 文件。

将此文件包含在生成的 jar 中的最佳方法是什么?我不想将它放入 src/main/resources 目录,因为这会污染我的默认资源目录。

是否没有源代码中的“生成资源”目录?

最佳答案

我以为有一个默认的 generated-resources 目录,但目前我找不到任何相关文档。您始终可以在 pom 中配置其他资源目录:

<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
...
</build>

关于java - 将生成的构建文件添加到类路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9292908/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com