码迷,mamicode.com
首页 > 移动开发 > 详细

maven:log4j:WARN No appenders could be found for logger (loggerInfo).或者maven build error:org.apache.maven.lifecycle.LifecycleExecutionExceptio

时间:2014-07-27 10:10:22      阅读:288      评论:0      收藏:0      [点我收藏+]

标签:

maven在build构建时,加载资源文件时需要配置资源文件插件:

1,在pom.xml文件中加入

<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项目

3,重新运行,OK!

不添加插件,将在main方法里会无法正常初始化log4j,产生异常:

maven:log4j:WARN No appenders could be 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 be found for logger (loggerInfo).或者maven build error:org.apache.maven.lifecycle.LifecycleExecutionExceptio

标签:

原文地址:http://www.cnblogs.com/xiluhua/p/3870516.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!