'use strict';

var xml = require('xml2json');

var readProp = function(json, prop) {
  if(prop.match(/^\$\{(.+)\}/)){
    return json.project.properties[prop.match(/^\$\{(.+)\}/)[1]]
  } else {
    return prop
  }
}

var maven = function(str) {
  var json;
  try { json = JSON.parse(xml.toJson(str)); } catch(err) { return []; }
  var deps = json.project.dependencies.dependency;
  return deps.reduce(function(accum, dep) {
    accum.push({
      name: readProp(json, dep.groupId) + ":" + readProp(json, dep.artifactId),
      version: readProp(json, dep.version),
      type: readProp(json, dep.scope) || 'runtime'
    });
    return accum;
  }, []);
};

module.exports = maven;

@@ -83,24 +83,32 @@
  %7B%0A  if(prop
+ && prop
 .match(/%5E%5C$%5C
@@ -381,16 +381,143 @@
 ndency;%0A
+  if(json.project.dependencyManagement)%7B%0A    deps = deps.concat(json.project.dependencyManagement.dependencies.dependency)%0A  %7D%0A
   return

Support dependencyManagement in maven