ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Building log4j

Building log4j

原创 Linux操作系统 作者:zhmsun 时间:2012-03-15 23:00:28 0 删除 编辑

想要查看log4j的源码。因此下载了最新的apache-log4j-1.2.16来看看。

光看还不过瘾,要本机重新打包玩玩。

把构建过程中遇到的错误记录如下:

0.maven版本 :
mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: E:\worksofts\apache-maven-3.0.4
Java version: 1.6.0_05, vendor: Sun Microsystems Inc.
Java home: E:\worksofts\bea\jdk160_05\jre
Default locale: zh_CN, platform. encoding: GBK
OS name: "windows vista", version: "6.1", arch: "x86", family: "windows"


最开始构建有错误,但是提示不清楚,因此加参数:mvn install -e -X

1.发现错误如下:
[ERROR]
[ERROR] The project log4j:log4j:1.2.16 (D:\eclipse\myprojects\apache-log4j-1.2
.16\pom.xml) has 1 error
[ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].
dependencies.dependency.scope' for junit:junit:jar must be one of [compile, runt
ime, system] but is 'test'. @ line 303, column 20
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin
gException

估计应该不是pom.xml的问题,因此考虑换mvn版本试试。更换为 2.2.1

2.更换版本
mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.6.0_05
Java home: E:\worksofts\bea\jdk160_05\jre
Default locale: zh_CN, platform. encoding: GBK
OS name: "windows vista" version: "6.1" arch: "x86" Family: "windows"

再次构建,出现如下错误:
Caused by: org.apache.maven.reporting.MavenReportException:
Exit code: 1 - java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
at sun.misc.URLClassPath$FileLoader.(URLClassPath.java:953)
at sun.misc.URLClassPath$3.run(URLClassPath.java:326)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
at sun.misc.URLClassPath.findResource(URLClassPath.java:144)
at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
at java.lang.ClassLoader.getResource(ClassLoader.java:977)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1159)
at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport
.java:89)......

3.发现mvn的环境变量设置可能出现错误。重置环境变量。
set CLASSPATH=
再次构建:
[INFO] Writing OBR metadata
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 43 seconds
[INFO] Finished at: Thu Mar 15 22:53:35 CST 2012
[INFO] Final Memory: 31M/57M
[INFO] ------------------------------------------------------------------------

终于看到了BUILD SUCCESSFUL !

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12257306/viewspace-718707/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-12-22

  • 博文量
    4
  • 访问量
    2659