Class JavaClass::Classpath::MavenArtefact
In: lib/javaclass/classpath/maven_artefact.rb
Parent: Object

A reference to a Maven artefact. This is a group/artefact/version tuple that points to a single Jar in the Maven repository.

Author:Peter Kofler

Methods

Attributes

group  [R] 
name  [R] 
title  [R] 
version  [R] 

Public Class methods

Create a Maven artefact with given group , name and version .

[Source]

# File lib/javaclass/classpath/maven_artefact.rb, line 13
      def initialize(group, name, version, title=nil)
        @group = group
        @name = name
        @version = version
        @title = title || make_title
      end

Public Instance methods

Return this Maven artefact‘s JavaClass::Classpath. This is a single Jar in the Maven repository.

[Source]

# File lib/javaclass/classpath/maven_artefact.rb, line 28
      def classpath
        cp = CompositeClasspath.new(basename)
        cp.add_file_name(repository_path)
        cp
      end

Kind of hack function to call Maven to download the current artefact if it does not exist.

[Source]

# File lib/javaclass/classpath/maven_artefact.rb, line 21
      def download_if_needed
        unless File.exist? repository_path
          puts `#{download_command}`
        end
      end

Return the Jar‘s file path of this artefact inside ~/.m2/repository

[Source]

# File lib/javaclass/classpath/maven_artefact.rb, line 35
      def repository_path
        File.join(ENV['HOME'], '.m2', 'repository', @group.gsub(/\./, '/'),  @name, @version, "#{basename}.jar" )
      end

[Validate]