maven 将 log4j 配置文件移出 jar

maven 将 log4j 配置文件移出 jar

pom.xml 配置:

<resources>
      <resource>
        <targetPath>${project.build.directory}/conf</targetPath>
        <directory>conf</directory>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <resource>
        <targetPath>${project.build.directory}/conf</targetPath>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <resource>
        <targetPath>${project.build.directory}/bin</targetPath>
        <directory>bin</directory>
      </resource>
</resources>

修改读取配置路径

PropertyConfigurator.configure("conf/log4j.properties");
本文为原创内容,作者:闲鹤,原文链接:https://blog.uwenya.cc/838.html,转载请注明出处。

发表评论