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");

发表评论