diff --git a/lib/license_finder/cli/main.rb b/lib/license_finder/cli/main.rb
index 93fad3ecf..ee1eed2cd 100644
--- a/lib/license_finder/cli/main.rb
+++ b/lib/license_finder/cli/main.rb
@@ -16,7 +16,8 @@ class Main < Base
'text' => TextReport,
'html' => HtmlReport,
'markdown' => MarkdownReport,
- 'csv' => CsvReport
+ 'csv' => CsvReport,
+ 'xml' => XmlReport
}.freeze
class_option :go_full_version, desc: 'Whether dependency version should include full version. Only meaningful if used with a Go project. Defaults to false.'
diff --git a/lib/license_finder/report.rb b/lib/license_finder/report.rb
index 277282eb6..bd46e43f6 100644
--- a/lib/license_finder/report.rb
+++ b/lib/license_finder/report.rb
@@ -28,3 +28,4 @@ def sorted_dependencies
require 'license_finder/reports/merged_report'
require 'license_finder/reports/html_report'
require 'license_finder/reports/markdown_report'
+require 'license_finder/reports/xml_report'
diff --git a/lib/license_finder/reports/templates/xml_report.erb b/lib/license_finder/reports/templates/xml_report.erb
new file mode 100644
index 000000000..d3c3a57d6
--- /dev/null
+++ b/lib/license_finder/reports/templates/xml_report.erb
@@ -0,0 +1,19 @@
+
+
+
+ <% sorted_dependencies.each do |dependency| -%>
+
+ <%= dependency.name %>
+ <%= dependency.version %>
+
+ <% dependency.licenses.each do |license| -%>
+
+ <%= license.name %>
+ <%= license.url %>
+
+ <% end -%>
+
+
+ <% end -%>
+
+
diff --git a/lib/license_finder/reports/xml_report.rb b/lib/license_finder/reports/xml_report.rb
new file mode 100644
index 000000000..c23f685a5
--- /dev/null
+++ b/lib/license_finder/reports/xml_report.rb
@@ -0,0 +1,19 @@
+require 'license_finder/reports/erb_report'
+
+module LicenseFinder
+ class XmlReport < ErbReport
+ ROOT_PATH = Pathname.new(__FILE__).dirname
+ TEMPLATE_PATH = ROOT_PATH.join('templates')
+
+ def to_s(filename = TEMPLATE_PATH.join("#{template_name}.erb"))
+ template = ERB.new(filename.read, nil, '-')
+ template.result(binding)
+ end
+
+ private
+
+ def template_name
+ 'xml_report'
+ end
+ end
+end
diff --git a/spec/lib/license_finder/reports/xml_report_spec.rb b/spec/lib/license_finder/reports/xml_report_spec.rb
new file mode 100644
index 000000000..154e7266d
--- /dev/null
+++ b/spec/lib/license_finder/reports/xml_report_spec.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+module LicenseFinder
+ describe XmlReport do
+ let(:dep1) do
+ result = Package.new('dep_1', '1.0')
+ result.decide_on_license(License.find_by_name('MIT'))
+ result
+ end
+
+ let(:dep2) do
+ result = Package.new('dep_2', '2.0')
+ result.decide_on_license(License.find_by_name('BSD'))
+ result
+ end
+
+ let(:expected_report) do
+ <<-XML
+
+
+
+
+ dep_1
+ 1.0
+
+
+ MIT
+ http://opensource.org/licenses/mit-license
+
+
+
+
+ dep_2
+ 2.0
+
+
+ BSD
+ http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29
+
+
+
+
+
+ XML
+ end
+
+ subject { described_class.new([dep1, dep2], {}) }
+
+ it 'should generate the correct xml report with name, version and license' do
+ expect(subject.to_s.gsub(/\s/, '')).to eq(expected_report.gsub(/\s/, ''))
+ end
+ end
+end