简体   繁体   English

尝试在Maven中编译带有依赖项的jar时未添加属性文件

[英]Properties file not added while trying to compile 'jar-with-dependencies' in Maven

I'm trying to generate a jar file with Maven Assembly Plugin. 我正在尝试使用Maven Assembly Plugin生成jar文件。 All is correct except for my log4j.properties file; 除了我的log4j.properties文件,其他所有内容都正确; when I run the jar file the console output: 当我运行jar文件时,控制台输出:

log4j:WARN No appenders could be found for logger (com.xxxxxxxxxx.web.processengine.Main). log4j:WARN找不到记录程序(com.xxxxxxxxxx.web.processengine.Main)的附加程序。 log4j:WARN Please initialize the log4j system properly. log4j:WARN请正确初始化log4j系统。 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. log4j:WARN有关更多信息,请参见http://logging.apache.org/log4j/1.2/faq.html#noconfig

In Eclipse works well; 在Eclipse中效果很好; so I assume is some type of compiling problem; 所以我假设是某种类型的编译问题; here is my assembly plugin pom configuration: 这是我的程序集插件pom配置:

<plugin>
        <artifactId>maven-assembly-plugin</artifactId>

        <configuration>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>  
            <archive>
                <manifest>
                    <mainClass>com.xxxxxxxxx.web.processengine.Main</mainClass>
                </manifest>
            </archive>
        </configuration>

        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
      </executions>
    </plugin>

I appreciate any help, thanks. 感谢您的帮助,谢谢。

尝试将log4j.properties文件放在src / main / resources文件夹中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM