我試圖使用buildr
來構建我的Java項目。我有一大堆的concordion測試和HTML規格,位於象這樣:Buildr - 將類測試資源放在類路徑上
src/test/java/spec/x/y/z/SomethingTest.java
src/test/resources/spec/x/y/z/Something.html
buildr
發現實際的測試代碼(SomethingTest.java
)並運行它,但HTML不會在classpath中結束,因此測試失敗。我得到以下錯誤:
[junit] Testcase: [Concordion Specification for 'Something'] took 0.002 sec
[junit] Caused an ERROR
[junit] Resource '[classpath: /x/y/z/Something.html]' not found
[junit] java.io.IOException: Resource '[classpath: /x/y/z/Something.html]' not found
[junit] at org.concordion.internal.ClassPathSource.createInputStream(ClassPathSource.java:15)
[junit] at org.concordion.internal.XMLSpecificationReader.readSpecification(XMLSpecificationReader.java:25)
[junit] at org.concordion.Concordion.process(Concordion.java:30)
[junit] at org.concordion.Concordion.process(Concordion.java:26)
[junit] at org.concordion.internal.FixtureRunner.run(FixtureRunner.java:18)
[junit] at org.concordion.integration.junit4.ConcordionRunner$1.evaluate(ConcordionRunner.java:113)
[junit] at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:104)
[junit] at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:18)
[junit]
[junit] TEST x.y.z.SomethingTest FAILED
我buildfile
如下:
repositories.remote = 'http://www.ibiblio.org/maven2'
JODA = 'joda-time:joda-time:jar:2.0'
CONCORDION = 'org.concordion:concordion:jar:1.4.2'
XERCES = 'xerces:xercesImpl:jar:2.8.1'
XOM = 'xom:xom:jar:1.2.5'
define 'my-project' do
project.version = '0.0.1'
compile.with JODA
test.with XERCES, XOM, CONCORDION
package :jar
end
我曾嘗試到HTML文件強制使用上對Java.classpath << 'src/test/resources/x/y/z'
和test.resources.include
,但無濟於事變化的類路徑。我相信我只是想念一些簡單的東西。任何幫助將不勝感激。
如何訪問資源?將.java文件旁邊的html文件解決問題? – 2012-03-11 17:21:15