Class: Dependabot::FileUpdaters::Java::Maven

Inherits:
Base
  • Object
show all
Defined in:
lib/dependabot/file_updaters/java/maven.rb,
lib/dependabot/file_updaters/java/maven/declaration_finder.rb,
lib/dependabot/file_updaters/java/maven/property_value_updater.rb

Defined Under Namespace

Classes: DeclarationFinder, PropertyValueUpdater

Instance Attribute Summary

Attributes inherited from Base

#credentials, #dependencies, #dependency_files

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dependabot::FileUpdaters::Base

Class Method Details

.updated_files_regexObject



13
14
15
# File 'lib/dependabot/file_updaters/java/maven.rb', line 13

def self.updated_files_regex
  [/^pom\.xml$/, %r{/pom\.xml$}]
end

Instance Method Details

#updated_dependency_filesObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dependabot/file_updaters/java/maven.rb', line 17

def updated_dependency_files
  updated_files = dependency_files.dup

  # Loop through each of the changed requirements, applying changes to
  # all pomfiles for that change. Note that the logic is different here
  # to other languages because Java has property inheritance across
  # files
  dependencies.each do |dependency|
    updated_files = update_pomfiles_for_dependency(
      pomfiles: updated_files,
      dependency: dependency
    )
  end

  updated_files.select! { |f| f.name.end_with?("pom.xml") }
  updated_files.reject! { |f| original_pomfiles.include?(f) }

  raise "No files changed!" if updated_files.none?
  if updated_files.any? { |f| f.name.end_with?("pom_parent.xml") }
    raise "Updated a supporting POM!"
  end

  updated_files
end