2
美好的一天當引用庫中的類擴展時,構建失敗
我正在使用maven構建我的java項目。我已經添加了一個log4j jar作爲依賴項,並嘗試使用extend
的RollingFileAppender
類。我試圖再次構建它,並出人意料地發生錯誤。從引用的庫/罐禁止擴展類嗎?
下面是行家說錯誤:
[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>
謝謝!
請顯示您的pom文件,因爲我假設您使用範圍測試添加了依賴項。 – khmarbaise
好的,稍等片刻我會編輯我的帖子。 – Oneb