You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Nikos Maris <ni...@gmail.com> on 2010/08/27 22:56:43 UTC

eclipse task without m2_repo

How could I refactor the following code? As I don't want my classpath file
to include the M2_REPO variable, I want this variable to be unbounded after
every invocation of the eclipse task.

desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath'); end"
def noneedfor_m2eclipse(path)
if File.exists? path then
unbounded = File.read(path).gsub(/M2_REPO/,
repositories.local).gsub(/kind="var"/, 'kind="lib"')
File.open(path, "w") {|file| file.puts unbounded}
end
end

Re: eclipse task without m2_repo

Posted by Antoine Toulme <an...@lunar-ocean.com>.
You're not wrong, but this is unsupported. We would need to let you specify
it is lib instead of var.
Please file a request for enhancement (I don't think this is a bug :)).

On Fri, Aug 27, 2010 at 16:53, Nikos Maris <ni...@gmail.com> wrote:

> But eclipse can not find a classpath jar when the path is absolute and the
> kind is "var". Am I wrong?
>
> On Sat, Aug 28, 2010 at 1:34 AM, Alex Boisvert <alex.boisvert@gmail.com
> >wrote:
>
> > No, eclipse.options.m2_repo_var is supposed to allow you to customize the
> > name used for the variable.  e.g. M2_REPO => FOO_REPO. If I remember
> > correctly, it was added because one user had different repos for
> different
> > workspaces.  In any case, kind="var" is correct for that use-case which
> is
> > why I was suggesting to use eclipse.options.m2_repo, a different variable
> > name, to customize the absolute path.
> >
> > alex
> >
> >
> > On Fri, Aug 27, 2010 at 3:26 PM, Nikos Maris <ni...@gmail.com> wrote:
> >
> > > Although a javadoc_artifact method is a possible improvement, the kind
> > > variable issue is a bug. Isn't it?
> > >
> > > On Sat, Aug 28, 2010 at 1:03 AM, Alex Boisvert <
> alex.boisvert@gmail.com
> > > >wrote:
> > >
> > > > Yeah, in that case we could support eclipse.options.m2_repo that
> would
> > be
> > > a
> > > > path and output artifacts with kind="lib".
> > > >
> > > > alex
> > > >
> > > > On Fri, Aug 27, 2010 at 2:59 PM, Nikos Maris <ni...@gmail.com>
> > wrote:
> > > >
> > > > > Problem is not solved as eclipse does not work out-of-the-box. When
> > > > > setting eclipse.options.m2_repo_var,
> > > > > kind="lib" should be added to Eclipse .classpath instead of
> > kind="var"
> > > as
> > > > > stated here (http://eclim.org/vim/java/classpath.html)
> > > > >
> > > > > Do you think that a specific issue should be raised?
> > > > >
> > > > > On Sat, Aug 28, 2010 at 12:28 AM, Nikos Maris <ni...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Thanks for responding in 7 minutes! Which would be an elegant way
> > to
> > > > > > configure the task to add javadocpath to Eclipse
> > > > > > .classpath "ecliple.options.javadoc = true"?
> > > > > >
> > > > > > On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <
> > > > alex.boisvert@gmail.com
> > > > > >wrote:
> > > > > >
> > > > > >> In your top-level project, just add:
> > > > > >>
> > > > > >> eclipse.options.m2_repo_var = Buildr.repositories.local
> > > > > >>
> > > > > >> This will "hard-code" your repository path into the Eclipse
> > > > .classpath.
> > > > > >>
> > > > > >> alex
> > > > > >>
> > > > > >>
> > > > > >> On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <
> nickmeet@gmail.com>
> > > > > wrote:
> > > > > >>
> > > > > >> > How could I refactor the following code? As I don't want my
> > > > classpath
> > > > > >> file
> > > > > >> > to include the M2_REPO variable, I want this variable to be
> > > > unbounded
> > > > > >> after
> > > > > >> > every invocation of the eclipse task.
> > > > > >> >
> > > > > >> > desc "usage: task :eclipse do noneedfor_m2eclipse
> > _('.classpath');
> > > > > end"
> > > > > >> > def noneedfor_m2eclipse(path)
> > > > > >> > if File.exists? path then
> > > > > >> > unbounded = File.read(path).gsub(/M2_REPO/,
> > > > > >> > repositories.local).gsub(/kind="var"/, 'kind="lib"')
> > > > > >> > File.open(path, "w") {|file| file.puts unbounded}
> > > > > >> > end
> > > > > >> > end
> > > > > >> >
> > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: eclipse task without m2_repo

Posted by Nikos Maris <ni...@gmail.com>.
But eclipse can not find a classpath jar when the path is absolute and the
kind is "var". Am I wrong?

On Sat, Aug 28, 2010 at 1:34 AM, Alex Boisvert <al...@gmail.com>wrote:

> No, eclipse.options.m2_repo_var is supposed to allow you to customize the
> name used for the variable.  e.g. M2_REPO => FOO_REPO. If I remember
> correctly, it was added because one user had different repos for different
> workspaces.  In any case, kind="var" is correct for that use-case which is
> why I was suggesting to use eclipse.options.m2_repo, a different variable
> name, to customize the absolute path.
>
> alex
>
>
> On Fri, Aug 27, 2010 at 3:26 PM, Nikos Maris <ni...@gmail.com> wrote:
>
> > Although a javadoc_artifact method is a possible improvement, the kind
> > variable issue is a bug. Isn't it?
> >
> > On Sat, Aug 28, 2010 at 1:03 AM, Alex Boisvert <alex.boisvert@gmail.com
> > >wrote:
> >
> > > Yeah, in that case we could support eclipse.options.m2_repo that would
> be
> > a
> > > path and output artifacts with kind="lib".
> > >
> > > alex
> > >
> > > On Fri, Aug 27, 2010 at 2:59 PM, Nikos Maris <ni...@gmail.com>
> wrote:
> > >
> > > > Problem is not solved as eclipse does not work out-of-the-box. When
> > > > setting eclipse.options.m2_repo_var,
> > > > kind="lib" should be added to Eclipse .classpath instead of
> kind="var"
> > as
> > > > stated here (http://eclim.org/vim/java/classpath.html)
> > > >
> > > > Do you think that a specific issue should be raised?
> > > >
> > > > On Sat, Aug 28, 2010 at 12:28 AM, Nikos Maris <ni...@gmail.com>
> > > wrote:
> > > >
> > > > > Thanks for responding in 7 minutes! Which would be an elegant way
> to
> > > > > configure the task to add javadocpath to Eclipse
> > > > > .classpath "ecliple.options.javadoc = true"?
> > > > >
> > > > > On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <
> > > alex.boisvert@gmail.com
> > > > >wrote:
> > > > >
> > > > >> In your top-level project, just add:
> > > > >>
> > > > >> eclipse.options.m2_repo_var = Buildr.repositories.local
> > > > >>
> > > > >> This will "hard-code" your repository path into the Eclipse
> > > .classpath.
> > > > >>
> > > > >> alex
> > > > >>
> > > > >>
> > > > >> On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com>
> > > > wrote:
> > > > >>
> > > > >> > How could I refactor the following code? As I don't want my
> > > classpath
> > > > >> file
> > > > >> > to include the M2_REPO variable, I want this variable to be
> > > unbounded
> > > > >> after
> > > > >> > every invocation of the eclipse task.
> > > > >> >
> > > > >> > desc "usage: task :eclipse do noneedfor_m2eclipse
> _('.classpath');
> > > > end"
> > > > >> > def noneedfor_m2eclipse(path)
> > > > >> > if File.exists? path then
> > > > >> > unbounded = File.read(path).gsub(/M2_REPO/,
> > > > >> > repositories.local).gsub(/kind="var"/, 'kind="lib"')
> > > > >> > File.open(path, "w") {|file| file.puts unbounded}
> > > > >> > end
> > > > >> > end
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: eclipse task without m2_repo

Posted by Alex Boisvert <al...@gmail.com>.
No, eclipse.options.m2_repo_var is supposed to allow you to customize the
name used for the variable.  e.g. M2_REPO => FOO_REPO. If I remember
correctly, it was added because one user had different repos for different
workspaces.  In any case, kind="var" is correct for that use-case which is
why I was suggesting to use eclipse.options.m2_repo, a different variable
name, to customize the absolute path.

alex


On Fri, Aug 27, 2010 at 3:26 PM, Nikos Maris <ni...@gmail.com> wrote:

> Although a javadoc_artifact method is a possible improvement, the kind
> variable issue is a bug. Isn't it?
>
> On Sat, Aug 28, 2010 at 1:03 AM, Alex Boisvert <alex.boisvert@gmail.com
> >wrote:
>
> > Yeah, in that case we could support eclipse.options.m2_repo that would be
> a
> > path and output artifacts with kind="lib".
> >
> > alex
> >
> > On Fri, Aug 27, 2010 at 2:59 PM, Nikos Maris <ni...@gmail.com> wrote:
> >
> > > Problem is not solved as eclipse does not work out-of-the-box. When
> > > setting eclipse.options.m2_repo_var,
> > > kind="lib" should be added to Eclipse .classpath instead of kind="var"
> as
> > > stated here (http://eclim.org/vim/java/classpath.html)
> > >
> > > Do you think that a specific issue should be raised?
> > >
> > > On Sat, Aug 28, 2010 at 12:28 AM, Nikos Maris <ni...@gmail.com>
> > wrote:
> > >
> > > > Thanks for responding in 7 minutes! Which would be an elegant way to
> > > > configure the task to add javadocpath to Eclipse
> > > > .classpath "ecliple.options.javadoc = true"?
> > > >
> > > > On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <
> > alex.boisvert@gmail.com
> > > >wrote:
> > > >
> > > >> In your top-level project, just add:
> > > >>
> > > >> eclipse.options.m2_repo_var = Buildr.repositories.local
> > > >>
> > > >> This will "hard-code" your repository path into the Eclipse
> > .classpath.
> > > >>
> > > >> alex
> > > >>
> > > >>
> > > >> On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com>
> > > wrote:
> > > >>
> > > >> > How could I refactor the following code? As I don't want my
> > classpath
> > > >> file
> > > >> > to include the M2_REPO variable, I want this variable to be
> > unbounded
> > > >> after
> > > >> > every invocation of the eclipse task.
> > > >> >
> > > >> > desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath');
> > > end"
> > > >> > def noneedfor_m2eclipse(path)
> > > >> > if File.exists? path then
> > > >> > unbounded = File.read(path).gsub(/M2_REPO/,
> > > >> > repositories.local).gsub(/kind="var"/, 'kind="lib"')
> > > >> > File.open(path, "w") {|file| file.puts unbounded}
> > > >> > end
> > > >> > end
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
>

Re: eclipse task without m2_repo

Posted by Nikos Maris <ni...@gmail.com>.
Although a javadoc_artifact method is a possible improvement, the kind
variable issue is a bug. Isn't it?

On Sat, Aug 28, 2010 at 1:03 AM, Alex Boisvert <al...@gmail.com>wrote:

> Yeah, in that case we could support eclipse.options.m2_repo that would be a
> path and output artifacts with kind="lib".
>
> alex
>
> On Fri, Aug 27, 2010 at 2:59 PM, Nikos Maris <ni...@gmail.com> wrote:
>
> > Problem is not solved as eclipse does not work out-of-the-box. When
> > setting eclipse.options.m2_repo_var,
> > kind="lib" should be added to Eclipse .classpath instead of kind="var" as
> > stated here (http://eclim.org/vim/java/classpath.html)
> >
> > Do you think that a specific issue should be raised?
> >
> > On Sat, Aug 28, 2010 at 12:28 AM, Nikos Maris <ni...@gmail.com>
> wrote:
> >
> > > Thanks for responding in 7 minutes! Which would be an elegant way to
> > > configure the task to add javadocpath to Eclipse
> > > .classpath "ecliple.options.javadoc = true"?
> > >
> > > On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <
> alex.boisvert@gmail.com
> > >wrote:
> > >
> > >> In your top-level project, just add:
> > >>
> > >> eclipse.options.m2_repo_var = Buildr.repositories.local
> > >>
> > >> This will "hard-code" your repository path into the Eclipse
> .classpath.
> > >>
> > >> alex
> > >>
> > >>
> > >> On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com>
> > wrote:
> > >>
> > >> > How could I refactor the following code? As I don't want my
> classpath
> > >> file
> > >> > to include the M2_REPO variable, I want this variable to be
> unbounded
> > >> after
> > >> > every invocation of the eclipse task.
> > >> >
> > >> > desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath');
> > end"
> > >> > def noneedfor_m2eclipse(path)
> > >> > if File.exists? path then
> > >> > unbounded = File.read(path).gsub(/M2_REPO/,
> > >> > repositories.local).gsub(/kind="var"/, 'kind="lib"')
> > >> > File.open(path, "w") {|file| file.puts unbounded}
> > >> > end
> > >> > end
> > >> >
> > >>
> > >
> > >
> >
>

Re: eclipse task without m2_repo

Posted by Alex Boisvert <al...@gmail.com>.
Yeah, in that case we could support eclipse.options.m2_repo that would be a
path and output artifacts with kind="lib".

alex

On Fri, Aug 27, 2010 at 2:59 PM, Nikos Maris <ni...@gmail.com> wrote:

> Problem is not solved as eclipse does not work out-of-the-box. When
> setting eclipse.options.m2_repo_var,
> kind="lib" should be added to Eclipse .classpath instead of kind="var" as
> stated here (http://eclim.org/vim/java/classpath.html)
>
> Do you think that a specific issue should be raised?
>
> On Sat, Aug 28, 2010 at 12:28 AM, Nikos Maris <ni...@gmail.com> wrote:
>
> > Thanks for responding in 7 minutes! Which would be an elegant way to
> > configure the task to add javadocpath to Eclipse
> > .classpath "ecliple.options.javadoc = true"?
> >
> > On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <alex.boisvert@gmail.com
> >wrote:
> >
> >> In your top-level project, just add:
> >>
> >> eclipse.options.m2_repo_var = Buildr.repositories.local
> >>
> >> This will "hard-code" your repository path into the Eclipse .classpath.
> >>
> >> alex
> >>
> >>
> >> On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com>
> wrote:
> >>
> >> > How could I refactor the following code? As I don't want my classpath
> >> file
> >> > to include the M2_REPO variable, I want this variable to be unbounded
> >> after
> >> > every invocation of the eclipse task.
> >> >
> >> > desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath');
> end"
> >> > def noneedfor_m2eclipse(path)
> >> > if File.exists? path then
> >> > unbounded = File.read(path).gsub(/M2_REPO/,
> >> > repositories.local).gsub(/kind="var"/, 'kind="lib"')
> >> > File.open(path, "w") {|file| file.puts unbounded}
> >> > end
> >> > end
> >> >
> >>
> >
> >
>

Re: eclipse task without m2_repo

Posted by Nikos Maris <ni...@gmail.com>.
Problem is not solved as eclipse does not work out-of-the-box. When
setting eclipse.options.m2_repo_var,
kind="lib" should be added to Eclipse .classpath instead of kind="var" as
stated here (http://eclim.org/vim/java/classpath.html)

Do you think that a specific issue should be raised?

On Sat, Aug 28, 2010 at 12:28 AM, Nikos Maris <ni...@gmail.com> wrote:

> Thanks for responding in 7 minutes! Which would be an elegant way to
> configure the task to add javadocpath to Eclipse
> .classpath "ecliple.options.javadoc = true"?
>
> On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <al...@gmail.com>wrote:
>
>> In your top-level project, just add:
>>
>> eclipse.options.m2_repo_var = Buildr.repositories.local
>>
>> This will "hard-code" your repository path into the Eclipse .classpath.
>>
>> alex
>>
>>
>> On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com> wrote:
>>
>> > How could I refactor the following code? As I don't want my classpath
>> file
>> > to include the M2_REPO variable, I want this variable to be unbounded
>> after
>> > every invocation of the eclipse task.
>> >
>> > desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath'); end"
>> > def noneedfor_m2eclipse(path)
>> > if File.exists? path then
>> > unbounded = File.read(path).gsub(/M2_REPO/,
>> > repositories.local).gsub(/kind="var"/, 'kind="lib"')
>> > File.open(path, "w") {|file| file.puts unbounded}
>> > end
>> > end
>> >
>>
>
>

Re: eclipse task without m2_repo

Posted by Alex Boisvert <al...@gmail.com>.
Welcome :)

I think it should add javadocpath automatically (no configuration necessary)
if javadoc is available, similar to how we handle sourcepath.

e.g. from eclipse.rb

  if lib_artifact.respond_to? :sources_artifact
    source_path = lib_artifact.sources_artifact.to_s
    relative_source_path = source_path.sub(var_value, var_name)
    @xml.classpathentry :kind=>'var', :path=>relative_lib_path,
:sourcepath=>relative_source_path

alex



On Fri, Aug 27, 2010 at 2:28 PM, Nikos Maris <ni...@gmail.com> wrote:

> Thanks for responding in 7 minutes! Which would be an elegant way to
> configure the task to add javadocpath to Eclipse
> .classpath "ecliple.options.javadoc = true"?
>
> On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <alex.boisvert@gmail.com
> >wrote:
>
> > In your top-level project, just add:
> >
> > eclipse.options.m2_repo_var = Buildr.repositories.local
> >
> > This will "hard-code" your repository path into the Eclipse .classpath.
> >
> > alex
> >
> >
> > On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com> wrote:
> >
> > > How could I refactor the following code? As I don't want my classpath
> > file
> > > to include the M2_REPO variable, I want this variable to be unbounded
> > after
> > > every invocation of the eclipse task.
> > >
> > > desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath'); end"
> > > def noneedfor_m2eclipse(path)
> > > if File.exists? path then
> > > unbounded = File.read(path).gsub(/M2_REPO/,
> > > repositories.local).gsub(/kind="var"/, 'kind="lib"')
> > > File.open(path, "w") {|file| file.puts unbounded}
> > > end
> > > end
> > >
> >
>

Re: eclipse task without m2_repo

Posted by Nikos Maris <ni...@gmail.com>.
Thanks for responding in 7 minutes! Which would be an elegant way to
configure the task to add javadocpath to Eclipse
.classpath "ecliple.options.javadoc = true"?

On Sat, Aug 28, 2010 at 12:04 AM, Alex Boisvert <al...@gmail.com>wrote:

> In your top-level project, just add:
>
> eclipse.options.m2_repo_var = Buildr.repositories.local
>
> This will "hard-code" your repository path into the Eclipse .classpath.
>
> alex
>
>
> On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com> wrote:
>
> > How could I refactor the following code? As I don't want my classpath
> file
> > to include the M2_REPO variable, I want this variable to be unbounded
> after
> > every invocation of the eclipse task.
> >
> > desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath'); end"
> > def noneedfor_m2eclipse(path)
> > if File.exists? path then
> > unbounded = File.read(path).gsub(/M2_REPO/,
> > repositories.local).gsub(/kind="var"/, 'kind="lib"')
> > File.open(path, "w") {|file| file.puts unbounded}
> > end
> > end
> >
>

Re: eclipse task without m2_repo

Posted by Alex Boisvert <al...@gmail.com>.
In your top-level project, just add:

eclipse.options.m2_repo_var = Buildr.repositories.local

This will "hard-code" your repository path into the Eclipse .classpath.

alex


On Fri, Aug 27, 2010 at 1:56 PM, Nikos Maris <ni...@gmail.com> wrote:

> How could I refactor the following code? As I don't want my classpath file
> to include the M2_REPO variable, I want this variable to be unbounded after
> every invocation of the eclipse task.
>
> desc "usage: task :eclipse do noneedfor_m2eclipse _('.classpath'); end"
> def noneedfor_m2eclipse(path)
> if File.exists? path then
> unbounded = File.read(path).gsub(/M2_REPO/,
> repositories.local).gsub(/kind="var"/, 'kind="lib"')
> File.open(path, "w") {|file| file.puts unbounded}
> end
> end
>