Search code examples
javarubympxj

Error Reading Asta/Power Project


using ruby mpxj I get the following error reading a asta/power project file

/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>'

the ruby file looks like:

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

Not sure why this error appears because I'm able to view the program in Asta Project Viewer so the file must not be corrupt.


Solution

  • The issue is that MPXJ doesn't support the most recent Powerproject file format. I'm hoping to add that support in the next couple of weeks. Mail me directly to keep reminding me if you don't see any progress!