Maven:log4j:WARN No Appenders could is found for logger (loggerinfo). or Maven build Error:o Rg.apache.maven.lifecycle.LifecycleExecutionExceptio

Source: Internet
Author: User

When Maven builds the build, it needs to configure the resource file plug-in when loading the resource file:

1, add in the Pom.xml file

<build>
<finalName>${project.build.target.file.name}</finalName>
<directory>${basedir}/target</directory>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

2,project-->clean Project

3, re-run, ok!

Without adding a plug-in, the log4j will not initialize properly in the main method, resulting in an exception:

Maven:log4j:WARN No Appenders could is found for logger (loggerinfo).

MAVEN build error for project; Build errors for Zlsoft-web; Org.apache.maven.lifecycle.LifecycleExecutionException

Maven:log4j:WARN No Appenders could is found for logger (loggerinfo). or Maven build Error:o Rg.apache.maven.lifecycle.LifecycleExecutionExceptio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.