You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Dieter Vrancken <di...@luciad.com> on 2013/01/04 14:56:31 UTC

combining ivy4r and checkstyle:xml

Hi all,

I am trying to use the buildr 1.4.9 checkstyle:xml task together with ivy4r 0.12.10. I don't see how I can add the jars resolved by ivy4r to checkstyle:xml's class path. Of course, checkstyle reports "Unable to get class information for ..." for every import it couldn't find.

AFAICT, buildr/checkstyle constructs the class path for checkstyle when after_define is executed. At that moment, ivy4r has not resolved the artifacts yet. I don't see how I can change the class path afterwards.

Does anyone know how to let the two play together nicely?

Thanks,
Dieter

Re: combining ivy4r and checkstyle:xml

Posted by Dieter Vrancken <di...@luciad.com>.
Hi Alex,

I will try to do that during the weekend.

Thanks,
Dieter

On Fri, 4 Jan 2013 07:55:05 -0800
Alex Boisvert <al...@gmail.com> wrote:

> If you can set up a smallish project that exemplifies the issue, I'll see
> what I can do.
> 
> On Friday, January 4, 2013, Dieter Vrancken wrote:
> 
> > Hi all,
> >
> > I am trying to use the buildr 1.4.9 checkstyle:xml task together with
> > ivy4r 0.12.10. I don't see how I can add the jars resolved by ivy4r to
> > checkstyle:xml's class path. Of course, checkstyle reports "Unable to get
> > class information for ..." for every import it couldn't find.
> >
> > AFAICT, buildr/checkstyle constructs the class path for checkstyle when
> > after_define is executed. At that moment, ivy4r has not resolved the
> > artifacts yet. I don't see how I can change the class path afterwards.
> >
> > Does anyone know how to let the two play together nicely?
> >
> > Thanks,
> > Dieter

Re: combining ivy4r and checkstyle:xml

Posted by Peter Donald <pe...@realityforge.org>.
Hi,

On Mon, Jan 7, 2013 at 7:21 PM, Dieter Vrancken
<di...@luciad.com>wrote:

> D'oh! That should have been findbugs:xml.
>

I applied the same fix to the findbugs tasks so it should be fixed next
release - thanks for the heads up!

-- 
Cheers,

Peter Donald

Re: combining ivy4r and checkstyle:xml

Posted by Dieter Vrancken <di...@luciad.com>.
D'oh! That should have been findbugs:xml.

On Mon, 7 Jan 2013 09:33:39 +1100
Peter Donald <pe...@realityforge.org> wrote:

> Hi,
> 
> On Mon, Jan 7, 2013 at 8:05 AM, Dieter Vrancken
> <di...@luciad.com>wrote:
> 
> > I had already worked out a workaround when trying a dependency to a jar in
> > the local file system. I don't know if you saw it yet, but I logged
> > BUILDR-659 for that. BTW, the proguard:xml task has the same problem.
> >
> 
> I don't think proguard:xml is provided by the buildr project? I am not even
> sure where it is from. So you probably need to contact the authors of that
> extension to get it fixed.
> 
> Thanks for the heads up for checkstyle!

Re: combining ivy4r and checkstyle:xml

Posted by Peter Donald <pe...@realityforge.org>.
Hi,

On Mon, Jan 7, 2013 at 8:05 AM, Dieter Vrancken
<di...@luciad.com>wrote:

> I had already worked out a workaround when trying a dependency to a jar in
> the local file system. I don't know if you saw it yet, but I logged
> BUILDR-659 for that. BTW, the proguard:xml task has the same problem.
>

I don't think proguard:xml is provided by the buildr project? I am not even
sure where it is from. So you probably need to contact the authors of that
extension to get it fixed.

Thanks for the heads up for checkstyle!

-- 
Cheers,

Peter Donald

Re: combining ivy4r and checkstyle:xml

Posted by Dieter Vrancken <di...@luciad.com>.
Alex,

thank you so much! I was looking at it from the wrong angle, trying to add ivy.deps to checkstyle.extra_dependencies. Injecting indirectly via compile.dependencies by adding compiledeps as a prerequisite is very clever :)

I had already worked out a workaround when trying a dependency to a jar in the local file system. I don't know if you saw it yet, but I logged BUILDR-659 for that. BTW, the proguard:xml task has the same problem.

Cheers,
Dieter

On Sat, 5 Jan 2013 11:41:28 -0800
Alex Boisvert <al...@gmail.com> wrote:

> Ok, so the basic solution would be to add a dependency to checkstyle on
> ivy's compiledeps task so the compile dependencies are resolved before
> running checkstyle.  In your project,
> 
>   task("checkstyle:xml" => ["compiledeps"])
> 
> However, there's a little bug in checkstyle:xml where it doesn't handle
> String dependencies (instead of task dependencies).  You can work around
> this by writing,
> 
>   task("tweak-compiledeps" => ["compiledeps"]) do
>     compile.dependencies.map! { |a| a.is_a?(String) ? file(a) : a }
>   end
> 
>   task("checkstyle:xml" => ["tweak-compiledeps"])
> 
> I'll fix the checkstyle task so the hack won't be necessary in future
> releases.
> 
> alex
> 
> On Sat, Jan 5, 2013 at 9:04 AM, Dieter Vrancken
> <di...@luciad.com>wrote:
> 
> > Hi Alex,
> >
> > attached (I hope that is allowed by this list) is a minimal project that
> > demonstrates the issue. The source code depends on an external library
> > which is retrieved using ivy. Only one error is reported by checkstyle and
> > it indicates that it does not know about that library. The project compiles
> > without fail.
> >
> > I am running this on JRuby 1.7.1, but I don't think that matters. The
> > following command, when issued from the root folder of the zip, should
> > reproduce my result:
> >
> >   bundle update; bundle exec buildr clean
> > buildr-checkstyle+ivy:checkstyle:xml
> >
> > Thanks for looking into it,
> > Dieter
> >
> > On Fri, 4 Jan 2013 07:55:05 -0800
> > Alex Boisvert <al...@gmail.com> wrote:
> >
> > > If you can set up a smallish project that exemplifies the issue, I'll see
> > > what I can do.
> > >
> > > On Friday, January 4, 2013, Dieter Vrancken wrote:
> > >
> > > > Hi all,
> > > >
> > > > I am trying to use the buildr 1.4.9 checkstyle:xml task together with
> > > > ivy4r 0.12.10. I don't see how I can add the jars resolved by ivy4r to
> > > > checkstyle:xml's class path. Of course, checkstyle reports "Unable to
> > get
> > > > class information for ..." for every import it couldn't find.
> > > >
> > > > AFAICT, buildr/checkstyle constructs the class path for checkstyle when
> > > > after_define is executed. At that moment, ivy4r has not resolved the
> > > > artifacts yet. I don't see how I can change the class path afterwards.
> > > >
> > > > Does anyone know how to let the two play together nicely?
> > > >
> > > > Thanks,
> > > > Dieter

Re: combining ivy4r and checkstyle:xml

Posted by Alex Boisvert <al...@gmail.com>.
Ok, so the basic solution would be to add a dependency to checkstyle on
ivy's compiledeps task so the compile dependencies are resolved before
running checkstyle.  In your project,

  task("checkstyle:xml" => ["compiledeps"])

However, there's a little bug in checkstyle:xml where it doesn't handle
String dependencies (instead of task dependencies).  You can work around
this by writing,

  task("tweak-compiledeps" => ["compiledeps"]) do
    compile.dependencies.map! { |a| a.is_a?(String) ? file(a) : a }
  end

  task("checkstyle:xml" => ["tweak-compiledeps"])

I'll fix the checkstyle task so the hack won't be necessary in future
releases.

alex

On Sat, Jan 5, 2013 at 9:04 AM, Dieter Vrancken
<di...@luciad.com>wrote:

> Hi Alex,
>
> attached (I hope that is allowed by this list) is a minimal project that
> demonstrates the issue. The source code depends on an external library
> which is retrieved using ivy. Only one error is reported by checkstyle and
> it indicates that it does not know about that library. The project compiles
> without fail.
>
> I am running this on JRuby 1.7.1, but I don't think that matters. The
> following command, when issued from the root folder of the zip, should
> reproduce my result:
>
>   bundle update; bundle exec buildr clean
> buildr-checkstyle+ivy:checkstyle:xml
>
> Thanks for looking into it,
> Dieter
>
> On Fri, 4 Jan 2013 07:55:05 -0800
> Alex Boisvert <al...@gmail.com> wrote:
>
> > If you can set up a smallish project that exemplifies the issue, I'll see
> > what I can do.
> >
> > On Friday, January 4, 2013, Dieter Vrancken wrote:
> >
> > > Hi all,
> > >
> > > I am trying to use the buildr 1.4.9 checkstyle:xml task together with
> > > ivy4r 0.12.10. I don't see how I can add the jars resolved by ivy4r to
> > > checkstyle:xml's class path. Of course, checkstyle reports "Unable to
> get
> > > class information for ..." for every import it couldn't find.
> > >
> > > AFAICT, buildr/checkstyle constructs the class path for checkstyle when
> > > after_define is executed. At that moment, ivy4r has not resolved the
> > > artifacts yet. I don't see how I can change the class path afterwards.
> > >
> > > Does anyone know how to let the two play together nicely?
> > >
> > > Thanks,
> > > Dieter
>

Re: combining ivy4r and checkstyle:xml

Posted by Dieter Vrancken <di...@luciad.com>.
Hi Alex,

attached (I hope that is allowed by this list) is a minimal project that demonstrates the issue. The source code depends on an external library which is retrieved using ivy. Only one error is reported by checkstyle and it indicates that it does not know about that library. The project compiles without fail.

I am running this on JRuby 1.7.1, but I don't think that matters. The following command, when issued from the root folder of the zip, should reproduce my result:

  bundle update; bundle exec buildr clean buildr-checkstyle+ivy:checkstyle:xml

Thanks for looking into it,
Dieter

On Fri, 4 Jan 2013 07:55:05 -0800
Alex Boisvert <al...@gmail.com> wrote:

> If you can set up a smallish project that exemplifies the issue, I'll see
> what I can do.
> 
> On Friday, January 4, 2013, Dieter Vrancken wrote:
> 
> > Hi all,
> >
> > I am trying to use the buildr 1.4.9 checkstyle:xml task together with
> > ivy4r 0.12.10. I don't see how I can add the jars resolved by ivy4r to
> > checkstyle:xml's class path. Of course, checkstyle reports "Unable to get
> > class information for ..." for every import it couldn't find.
> >
> > AFAICT, buildr/checkstyle constructs the class path for checkstyle when
> > after_define is executed. At that moment, ivy4r has not resolved the
> > artifacts yet. I don't see how I can change the class path afterwards.
> >
> > Does anyone know how to let the two play together nicely?
> >
> > Thanks,
> > Dieter

Re: combining ivy4r and checkstyle:xml

Posted by Alex Boisvert <al...@gmail.com>.
If you can set up a smallish project that exemplifies the issue, I'll see
what I can do.

On Friday, January 4, 2013, Dieter Vrancken wrote:

> Hi all,
>
> I am trying to use the buildr 1.4.9 checkstyle:xml task together with
> ivy4r 0.12.10. I don't see how I can add the jars resolved by ivy4r to
> checkstyle:xml's class path. Of course, checkstyle reports "Unable to get
> class information for ..." for every import it couldn't find.
>
> AFAICT, buildr/checkstyle constructs the class path for checkstyle when
> after_define is executed. At that moment, ivy4r has not resolved the
> artifacts yet. I don't see how I can change the class path afterwards.
>
> Does anyone know how to let the two play together nicely?
>
> Thanks,
> Dieter
>