Sha256: 1ac553d4df35e3f1357355163c76790ed94aa840e09242e33f643c36d668f311

Contents?: true

Size: 672 Bytes

Versions: 3

Compression:

Stored size: 672 Bytes

Contents

require "xmlsimple"

module LicenseFinder
  class Maven < PackageManager
    def current_packages
      `mvn license:download-licenses`

      xml = license_report.read

      options = {
        'GroupTags' => { 'licenses' => 'license', 'dependencies' => 'dependency' },
        'ForceArray' => ['license', 'dependency']
      }
      dependencies = XmlSimple.xml_in(xml, options)["dependencies"]

      dependencies.map do |dep|
        MavenPackage.new(dep, logger: logger)
      end
    end

    private

    def license_report
      Pathname.new('target/generated-resources/licenses.xml')
    end

    def package_path
      Pathname.new('pom.xml')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
license_finder-2.0.0.rc2 lib/license_finder/package_managers/maven.rb
license_finder-1.2 lib/license_finder/package_managers/maven.rb
license_finder-1.2-java lib/license_finder/package_managers/maven.rb