使用ruby mpxj我在读取asta / power项目文件时出现以下错误
/var/lib/gems/2.3.0/gems/mpxj-5.2.2/lib/mpxj/reader.rb:24:in `read': Failed to read file: Reading input file started. (RuntimeError)
java.lang.UnsupportedOperationException
at net.sf.mpxj.asta.AstaFileReader.readDatabaseFile(AstaFileReader.java:126)
at net.sf.mpxj.asta.AstaFileReader.read(AstaFileReader.java:74)
at net.sf.mpxj.reader.AbstractProjectReader.read(AbstractProjectReader.java:49)
at net.sf.mpxj.sample.MpxjConvert.process(MpxjConvert.java:81)
at net.sf.mpxj.sample.MpxjConvert.main(MpxjConvert.java:56)
from test.rb:3:in `<main>'
ruby文件看起来像:
require 'mpxj'
project = MPXJ::Reader.read("asta.pp")
puts "There are #{project.all_tasks.size} tasks in this project"
puts "There are #{project.all_resources.size} resources in this project"
puts "The resources are:"
project.all_resources.each do |resource|
puts resource.name
end
puts "The tasks are:"
project.all_tasks.each do |task|
puts "#{task.name}: starts on #{task.start}, finishes on #{task.finish}, it's duration is #{task.duration}"
end
不确定为什么会出现此错误,因为我可以在Asta Project Viewer中查看该程序,因此该文件不得损坏。
答案 0 :(得分:0)
问题是MPXJ不支持最新的Powerproject文件格式。我希望在接下来的几周内增加这种支持。如果您没有看到任何进展,请直接给我发邮件以提醒我!