我正在試圖使用Scala宏註釋庫和this庫。無法獲取資源路徑
我在src/main/resources/avsc/FriendRequestAcceptedGson.avsc
我想如下指它在我的代碼模式文件:
@AvroTypeProvider("/avsc/FriendRequestAcceptedGson.avsc")
@AvroRecord
case class FriendRequestAcceptedGson()
這是錯誤我得到:
[error] /home/lee/Code/bigdata-friends/java/etl/src/main/scala/com/mxit/bd/friends/etl/Runner.scala:64: exception during macro expansion: [error] java.io.FileNotFoundException: /avsc/FriendRequestAcceptedGson.avsc (No such file or directory) [error] at java.io.FileInputStream.open(Native Method) [error] at java.io.FileInputStream.<init>(FileInputStream.java:146) [error] at org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:504) [error] at org.apache.avro.Schema$Parser.parse(Schema.java:922) [error] at com.julianpeeters.avro.annotations.util.SchemaParser$.getSchema(SchemaParser.scala:20) [error] at com.julianpeeters.avro.annotations.AvroTypeProviderMacro$.impl(TypeProviderMacro.scala:23) [error] @AvroTypeProvider("/avsc/FriendRequestAcceptedGson.avsc")
看起來avsc文件是從絕對路徑中拾取的。使用'avsc/FriendRequestAcceptedGson.avsc'會發生什麼? – 2014-10-28 13:48:16
同樣的問題:'''java.io.FileNotFoundException:avsc/FriendRequestAcceptedGson.avsc(沒有這樣的文件或目錄)''' – Lee 2014-10-28 13:52:01