buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geraldo Lopes de Souza <>
Subject javadoc_location javadocpath and eclipse
Date Sun, 03 Apr 2011 00:13:10 GMT

I'm using buildr eclipse to generate .project and .classpath files.
I've noted that javadocpath is generated as an attribute of classpathentry
Eclipse was not recognizing the docs even  they're at  the right place.
The definitions are relative to M2_REPO and I've defined the variable
properly (source and path are working)
Further investigation shows that javadoc can't be defined relative. I've
changed javadocpath to absolute paths with the same result.
I've changed manually and what appears to work is an entry like this:

  <classpathentry kind="var"
      <attribute name="javadoc_location"

Note that javadoc information is defined as javadoc_location with absolute

I've changed eclipse.rb class ClasspathEntryWriter,  var method to generate
the above output.

      # Write a classpathentry of kind 'var' (variable) for a library in a
local repo.
      # * +libs+ is an array of library paths.
      # * +var_name+ is a variable name as defined in Eclipse (e.g.,
      # * +var_value+ is the value of this variable (e.g., '/home/me/.m2').
      # E.g., <tt>var([lib1, lib2], 'M2_REPO', '/home/me/.m2/repo')</tt>
      def var(libs)
        libs.each do |lib_path, var_name, var_value|
          lib_artifact = file(lib_path)

          attribs = { :kind => 'var', :path => lib_path }

          if lib_artifact.respond_to? :sources_artifact
            attribs[:sourcepath] = lib_artifact.sources_artifact

#          if lib_artifact.respond_to? :javadoc_artifact
#            attribs[:javadocpath] = lib_artifact.javadoc_artifact
#          end

          # make all paths relative
          attribs.each_key do |k|
            attribs[k] = attribs[k].to_s.sub(var_value, var_name.to_s) if
k.to_s =~ /path/

#          @xml.classpathentry attribs
          @xml.classpathentry(attribs) {
              @xml.attribute :name => 'javadoc_location', :value =>

Now it's working properly.


Geraldo Lopes de Souza

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message