def add_dependency( mod=nil, dep )
    if !mod
      mod = '.rho'
    end

    @logger.info "Adding maven dependency for #{mod}: #{dep}"
    #return if remove_dependencies_with_lesser_versions(dep)

    if !@dependencies[mod]
      @dependencies[mod] = [ dep ]
    else
      @dependencies[mod] << dep
    end
  end
def add_dependency( mod=nil, dep )
    if !mod
      mod = '.rho'
    end

    @logger.info "Adding maven dependency for #{mod}: #{dep}"
    #return if remove_dependencies_with_lesser_versions(dep)

    if !@dependencies[mod]
      @dependencies[mod] = [ dep ]
    else
      @dependencies[mod] << dep
    end
  end
=begin
  # leaving this just in case, since maven will resolve dep versions itself

  def compare_versions( v1, v2 )
    version1 = v1.split('.').map { |s| s.to_i }
    version2 = v2.split('.').map { |s| s.to_i }

    version1.each_with_index do |v,i|
      diff = v - version2[i]
      return diff if (diff != 0)
    end

    return 0
  end

  #return true if have deps with version higher or equal than required
  def remove_dependencies_with_lesser_versions( dep )
    depGroup,depPackage,depVersion = split_dependency(dep)

    @logger.info "Will filter out dependecies #{depGroup}:#{depPackage} if version is less than #{depVersion}"

    haveExistingDependencyWithNonLessVersion = false
    @dependencies.each do |extension,dependencies|
      dependencies.delete_if do |dependency|
        group,package,version = split_dependency(dependency)
        if (group==depGroup) and (package==depPackage)
          @logger.info "Found already existing dependency #{dependency} for module #{extension}, will check version"
          if ( compare_versions(depVersion,version) > 0 )
            @logger.info "New dependency has higher version than existing one: #{depVersion} > #{version}. Will replace it."
            #remove existing dependency
            true
          else
            @logger.info "Existing dependency version is higher or equal than new one: #{depVersion} <= #{version}"
            haveExistingDependencyWithNonLessVersion = true
          end          
        end        
      end
    end
    return haveExistingDependencyWithNonLessVersion
  end
=end