【问题标题】:In multimodule maven project. Need to access conf/properties file from one child to another child在多模块 Maven 项目中。需要从一个孩子访问另一个孩子的配置/属性文件
【发布时间】:2016-12-13 22:15:17
【问题描述】:

我的项目是多模块

parent

|
-----Child A

     src/main/resources/test.conf
|
-----Child B

     src/main/test/ (from here I want to access conf)

我尝试了多种选择:

1) 添加了 Apache 资源包 (https://maven.apache.org/apache-resource-bundles/)

2) 在 pom.xml 中使用资源标签 With maven - clean package, xml source files are not included in classpath

【问题讨论】:

  • 一个观察:我可以添加 .properties 和 .xml。只有 .conf 不作为 jar 的一部分添加
  • 虽然您的问题似乎已得到解答,但我想知道答案如何满足您的要求,即您想从另一个孩子那里访问 test.conf
  • 我已将子 B 的依赖项添加到子 A。由于 conf 现在是 jar 的一部分,我可以访问这些 conf

标签: maven maven-plugin


【解决方案1】:

以下是我的回答,你需要从 pom 中删除排除,如果你有这个插件,你可以检查

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>${jar.plugin.version}</version> <configuration> <excludes> <exclude>job.xml</exclude> </excludes> </configuration> </plugin>

【讨论】:

    猜你喜欢
    • 2020-08-12
    • 2011-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多