当运行 mvn verify
时,我收到以下消息:
我已经将 log4j2.xml
放在 src/test/resources
下(但不在 src/main/resources
下,因为我不希望它按照建议与实际应用程序一起发货)here无济于事。
生成 HTML 报告,写入日志文件,构建成功,如上所示。我不确定错误来自何处。
最佳答案
根据http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration将 log4j2.xml
添加到类路径应该会有所帮助。
If a JSON file cannot be located the XML ConfigurationFactory will try to locate log4j2.xml on the classpath.
因此,如果您仍然收到错误消息,则不是您的来源问题。它看起来像是 maven-cucumber-reporting
插件中的问题。如此处所述http://maven.apache.org/guides/mini/guide-maven-classloading.html
Please note that the plugin classloader does neither contain the dependencies of the current project nor its build output.
如果 maven 插件在其自己的类路径(不包括您的源/资源)中找不到任何 log4j 配置,您将看到错误消息。所以是的,唯一的解决方案是等待发布修复 https://github.com/damianszczepanik/cucumber-reporting/issues/675
关于java - Maven - 错误 StatusLogger 找不到 log4j2 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49347945/