On Tue, Jul 7, 2009 at 3:11 PM, Martin Grotzke <[email protected]
> wrote:

> Thanx for the hint! It works, but to me it does not seem like a clean
> solution but rather like a workaround. For one thing my collegues would
> think that buildr needs hacks for such things, on the other hand I'd
> like to learn how to do this the "right" way :)


Another approach would be to mimic an existing idiom, e.g.,

  compile.options.source = "1.5"

using the following rough structure,

module Buildr
  module Eclipse
    def eclipse
      @eclipse || Eclipse.new
    end

    class Eclipse
      attr_reader :options

      def initialize
        @options = Options.new
      end
    end

    class Options
      attr_accessor :m2_repo_var

      def initialize
        @m2_repo_var = 'M2_REPO'
      end
    end
  end

    # existing code elided

  include Eclipse
end


which would lead to this in your buildfile:

eclipse.options.m2_repo_var = 'PROJ_REPO'

alex

Reply via email to