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
<[email protected]>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 <[email protected]> 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
>