再会
我正在使用 maven 来构建我的 java 项目。我添加了一个 log4j jar 作为依赖项并尝试了extend
它的RollingFileAppender
类。我尝试再次构建它,但令人惊讶的是发生了错误。是否禁止从引用的库/jar 扩展类?
下面是所说的Maven错误:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
c:\Users\jlim\Desktop\workspace\test-joven\src\main\java\com\joven\test\CustomRollingFileAppender.java:[3,23] error: package org.apache.log4j does not exist
[ERROR] c:\Users\jlim\Desktop\workspace\test-joven\src\main\java\com\joven\test\CustomRollingFileAppender.java:[5,47] error: cannot find symbol
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.045s
[INFO] Finished at: Mon May 20 15:56:14 CST 2013
[INFO] Final Memory: 12M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project test-joven: Compilation failure: Compilation failure:
[ERROR] bootstrap class path not set in conjunction with -source 1.6
[ERROR] c:\Users\jlim\Desktop\workspace\test-joven\src\main\java\com\joven\test\CustomRollingFileAppender.java:[3,23] error: package org.apache.log4j does not exist
[ERROR] c:\Users\jlim\Desktop\workspace\test-joven\src\main\java\com\joven\test\CustomRollingFileAppender.java:[5,47] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
下面是我的 pom.xml 的依赖块:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
</dependencies>
谢谢!