You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Joakim Ohlrogge <jo...@agical.com> on 2008/09/12 23:17:22 UTC

Problems with specs

Hi all,

I am new to builder and am in a bit of trouble. I am trying scala
specs in buildr 1.3.2 and it works fine until I want to make the spec
runnable with JUnit.
When I add

class PublishSiteGraphSpecTest extends JUnit4(PublishSiteGraphSpec)

To my spec I get:

NoClassDefFoundError: junit/framework/Test
rake aborted!
junit/framework/Test

from buildr.

I tried to add junit to test.with but it didn't work. I figured out
that my problem was related to the class-path of ScalaTest in
test_framework.rb and by adding JUnit::REQUIRES to the present list of
requirements, like this:

      # ScalaTest dependencies
      DEPENDS = ["org.scalatest:scalatest:jar:#{VERSION}"] +
                 JMock::REQUIRES +
                 ScalaSpecs::REQUIRES +
                 ScalaCheck::REQUIRES +
                 JUnit::REQUIRES

It works.

I bet there is a better way, I tried to open the class in ~/buildr.rb
and change the constant but I just get warnings that I'm trying to
change it. I also noticed that the buildr.rb is not picked up if I put
it in the same directory as my buildfile (the homepage says that
buildr will look for a buildr.rb in the build-directory and I assumed
that the build-directory is the same as the directory with the
buildfile?)

What is the best way to make this kind of patches? I would really like
to be able to make these changes by just checking in a buildr.rb
together with my buildfile or something comparably easy. Especially
since I noticed that you have to be root to change gem-files in
ubuntu.

I'm probably overlooking something simple and I can't seem to make
google dig up the correct information for me so I thought I'd ask
here.

Best regards!
/Joakim Ohlrogge

Re: Problems with specs

Posted by Assaf Arkin <ar...@intalio.com>.
On Sat, Sep 13, 2008 at 7:03 AM, Joakim Ohlrogge
<jo...@agical.com> wrote:
> Thanks for the pointer!
>
> You really made it easy to try the latest and greatest using GIT, I
> had no idea it was this easy. The _buildr script was simple and
> effective and now I know that I will be /pleasantly/ surprised by the
> next version of buildr. It works like charm and my immediate problem
> will be solved by the next version.
>
> I blogged about my experience here:
> http://johlrogge.wordpress.com/2008/09/13/buildr-keeping-up-with-the-latest-and-greatest/

Thanks.

Assaf

>
> I hope that it helps someone :)
>
> Thanks for your help!
> /J
>
>
>
>
>
> On Sat, Sep 13, 2008 at 6:42 AM, Assaf Arkin <ar...@intalio.com> wrote:
>> On Fri, Sep 12, 2008 at 3:06 PM, Alex Boisvert <bo...@intalio.com> wrote:
>>> Yes, the ScalaTest module needs to be monkey-patched early to add JUnit due
>>> to the way the test framework classes are loaded during bootstrap.
>>
>> First you want to test it against the latest changes (or be
>> unpleasantly surprised when 1.3.3 ships):
>> http://github.com/vic/buildr/commit/018769ab28f5b7f8085138eb748fdb9d3962252d
>>
>> Assaf
>>
>>
>>>
>>> There were was a discussion about making this cleaner in 1.3:
>>> http://groups.google.com/group/buildr-talk/browse_thread/thread/4ad0ef879e3a5313?fwc=1
>>>
>>> but I don't know if anything came out of it.
>>>
>>> Assaf?
>>>
>>>
>>>
>>> On Fri, Sep 12, 2008 at 2:17 PM, Joakim Ohlrogge <joakim.ohlrogge@agical.com
>>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am new to builder and am in a bit of trouble. I am trying scala
>>>> specs in buildr 1.3.2 and it works fine until I want to make the spec
>>>> runnable with JUnit.
>>>> When I add
>>>>
>>>> class PublishSiteGraphSpecTest extends JUnit4(PublishSiteGraphSpec)
>>>>
>>>> To my spec I get:
>>>>
>>>> NoClassDefFoundError: junit/framework/Test
>>>> rake aborted!
>>>> junit/framework/Test
>>>>
>>>> from buildr.
>>>>
>>>> I tried to add junit to test.with but it didn't work. I figured out
>>>> that my problem was related to the class-path of ScalaTest in
>>>> test_framework.rb and by adding JUnit::REQUIRES to the present list of
>>>> requirements, like this:
>>>>
>>>>      # ScalaTest dependencies
>>>>      DEPENDS = ["org.scalatest:scalatest:jar:#{VERSION}"] +
>>>>                 JMock::REQUIRES +
>>>>                 ScalaSpecs::REQUIRES +
>>>>                 ScalaCheck::REQUIRES +
>>>>                 JUnit::REQUIRES
>>>>
>>>> It works.
>>>>
>>>> I bet there is a better way, I tried to open the class in ~/buildr.rb
>>>> and change the constant but I just get warnings that I'm trying to
>>>> change it. I also noticed that the buildr.rb is not picked up if I put
>>>> it in the same directory as my buildfile (the homepage says that
>>>> buildr will look for a buildr.rb in the build-directory and I assumed
>>>> that the build-directory is the same as the directory with the
>>>> buildfile?)
>>>>
>>>> What is the best way to make this kind of patches? I would really like
>>>> to be able to make these changes by just checking in a buildr.rb
>>>> together with my buildfile or something comparably easy. Especially
>>>> since I noticed that you have to be root to change gem-files in
>>>> ubuntu.
>>>>
>>>> I'm probably overlooking something simple and I can't seem to make
>>>> google dig up the correct information for me so I thought I'd ask
>>>> here.
>>>>
>>>> Best regards!
>>>> /Joakim Ohlrogge
>>>>
>>>
>>
>
>
>
> --
> -----------------------------------------------------
> Joakim Ohlrogge
> Agical AB
> Västerlånggatan 79, 2 tr
> 111 29 Stockholm, SWEDEN
>
> Mobile: +46-708-754004
> Blog: johlrogge.wordpress.com
> E-mail: joakim.ohlrogge@agical.se
>

Re: Problems with specs

Posted by Joakim Ohlrogge <jo...@agical.com>.
Thanks for the pointer!

You really made it easy to try the latest and greatest using GIT, I
had no idea it was this easy. The _buildr script was simple and
effective and now I know that I will be /pleasantly/ surprised by the
next version of buildr. It works like charm and my immediate problem
will be solved by the next version.

I blogged about my experience here:
http://johlrogge.wordpress.com/2008/09/13/buildr-keeping-up-with-the-latest-and-greatest/

I hope that it helps someone :)

Thanks for your help!
/J





On Sat, Sep 13, 2008 at 6:42 AM, Assaf Arkin <ar...@intalio.com> wrote:
> On Fri, Sep 12, 2008 at 3:06 PM, Alex Boisvert <bo...@intalio.com> wrote:
>> Yes, the ScalaTest module needs to be monkey-patched early to add JUnit due
>> to the way the test framework classes are loaded during bootstrap.
>
> First you want to test it against the latest changes (or be
> unpleasantly surprised when 1.3.3 ships):
> http://github.com/vic/buildr/commit/018769ab28f5b7f8085138eb748fdb9d3962252d
>
> Assaf
>
>
>>
>> There were was a discussion about making this cleaner in 1.3:
>> http://groups.google.com/group/buildr-talk/browse_thread/thread/4ad0ef879e3a5313?fwc=1
>>
>> but I don't know if anything came out of it.
>>
>> Assaf?
>>
>>
>>
>> On Fri, Sep 12, 2008 at 2:17 PM, Joakim Ohlrogge <joakim.ohlrogge@agical.com
>>> wrote:
>>
>>> Hi all,
>>>
>>> I am new to builder and am in a bit of trouble. I am trying scala
>>> specs in buildr 1.3.2 and it works fine until I want to make the spec
>>> runnable with JUnit.
>>> When I add
>>>
>>> class PublishSiteGraphSpecTest extends JUnit4(PublishSiteGraphSpec)
>>>
>>> To my spec I get:
>>>
>>> NoClassDefFoundError: junit/framework/Test
>>> rake aborted!
>>> junit/framework/Test
>>>
>>> from buildr.
>>>
>>> I tried to add junit to test.with but it didn't work. I figured out
>>> that my problem was related to the class-path of ScalaTest in
>>> test_framework.rb and by adding JUnit::REQUIRES to the present list of
>>> requirements, like this:
>>>
>>>      # ScalaTest dependencies
>>>      DEPENDS = ["org.scalatest:scalatest:jar:#{VERSION}"] +
>>>                 JMock::REQUIRES +
>>>                 ScalaSpecs::REQUIRES +
>>>                 ScalaCheck::REQUIRES +
>>>                 JUnit::REQUIRES
>>>
>>> It works.
>>>
>>> I bet there is a better way, I tried to open the class in ~/buildr.rb
>>> and change the constant but I just get warnings that I'm trying to
>>> change it. I also noticed that the buildr.rb is not picked up if I put
>>> it in the same directory as my buildfile (the homepage says that
>>> buildr will look for a buildr.rb in the build-directory and I assumed
>>> that the build-directory is the same as the directory with the
>>> buildfile?)
>>>
>>> What is the best way to make this kind of patches? I would really like
>>> to be able to make these changes by just checking in a buildr.rb
>>> together with my buildfile or something comparably easy. Especially
>>> since I noticed that you have to be root to change gem-files in
>>> ubuntu.
>>>
>>> I'm probably overlooking something simple and I can't seem to make
>>> google dig up the correct information for me so I thought I'd ask
>>> here.
>>>
>>> Best regards!
>>> /Joakim Ohlrogge
>>>
>>
>



-- 
-----------------------------------------------------
Joakim Ohlrogge
Agical AB
Västerlånggatan 79, 2 tr
111 29 Stockholm, SWEDEN

Mobile: +46-708-754004
Blog: johlrogge.wordpress.com
E-mail: joakim.ohlrogge@agical.se

Re: Problems with specs

Posted by Assaf Arkin <ar...@intalio.com>.
On Fri, Sep 12, 2008 at 3:06 PM, Alex Boisvert <bo...@intalio.com> wrote:
> Yes, the ScalaTest module needs to be monkey-patched early to add JUnit due
> to the way the test framework classes are loaded during bootstrap.

First you want to test it against the latest changes (or be
unpleasantly surprised when 1.3.3 ships):
http://github.com/vic/buildr/commit/018769ab28f5b7f8085138eb748fdb9d3962252d

Assaf


>
> There were was a discussion about making this cleaner in 1.3:
> http://groups.google.com/group/buildr-talk/browse_thread/thread/4ad0ef879e3a5313?fwc=1
>
> but I don't know if anything came out of it.
>
> Assaf?
>
>
>
> On Fri, Sep 12, 2008 at 2:17 PM, Joakim Ohlrogge <joakim.ohlrogge@agical.com
>> wrote:
>
>> Hi all,
>>
>> I am new to builder and am in a bit of trouble. I am trying scala
>> specs in buildr 1.3.2 and it works fine until I want to make the spec
>> runnable with JUnit.
>> When I add
>>
>> class PublishSiteGraphSpecTest extends JUnit4(PublishSiteGraphSpec)
>>
>> To my spec I get:
>>
>> NoClassDefFoundError: junit/framework/Test
>> rake aborted!
>> junit/framework/Test
>>
>> from buildr.
>>
>> I tried to add junit to test.with but it didn't work. I figured out
>> that my problem was related to the class-path of ScalaTest in
>> test_framework.rb and by adding JUnit::REQUIRES to the present list of
>> requirements, like this:
>>
>>      # ScalaTest dependencies
>>      DEPENDS = ["org.scalatest:scalatest:jar:#{VERSION}"] +
>>                 JMock::REQUIRES +
>>                 ScalaSpecs::REQUIRES +
>>                 ScalaCheck::REQUIRES +
>>                 JUnit::REQUIRES
>>
>> It works.
>>
>> I bet there is a better way, I tried to open the class in ~/buildr.rb
>> and change the constant but I just get warnings that I'm trying to
>> change it. I also noticed that the buildr.rb is not picked up if I put
>> it in the same directory as my buildfile (the homepage says that
>> buildr will look for a buildr.rb in the build-directory and I assumed
>> that the build-directory is the same as the directory with the
>> buildfile?)
>>
>> What is the best way to make this kind of patches? I would really like
>> to be able to make these changes by just checking in a buildr.rb
>> together with my buildfile or something comparably easy. Especially
>> since I noticed that you have to be root to change gem-files in
>> ubuntu.
>>
>> I'm probably overlooking something simple and I can't seem to make
>> google dig up the correct information for me so I thought I'd ask
>> here.
>>
>> Best regards!
>> /Joakim Ohlrogge
>>
>

Re: Problems with specs

Posted by Alex Boisvert <bo...@intalio.com>.
Yes, the ScalaTest module needs to be monkey-patched early to add JUnit due
to the way the test framework classes are loaded during bootstrap.

There were was a discussion about making this cleaner in 1.3:
http://groups.google.com/group/buildr-talk/browse_thread/thread/4ad0ef879e3a5313?fwc=1

but I don't know if anything came out of it.

Assaf?



On Fri, Sep 12, 2008 at 2:17 PM, Joakim Ohlrogge <joakim.ohlrogge@agical.com
> wrote:

> Hi all,
>
> I am new to builder and am in a bit of trouble. I am trying scala
> specs in buildr 1.3.2 and it works fine until I want to make the spec
> runnable with JUnit.
> When I add
>
> class PublishSiteGraphSpecTest extends JUnit4(PublishSiteGraphSpec)
>
> To my spec I get:
>
> NoClassDefFoundError: junit/framework/Test
> rake aborted!
> junit/framework/Test
>
> from buildr.
>
> I tried to add junit to test.with but it didn't work. I figured out
> that my problem was related to the class-path of ScalaTest in
> test_framework.rb and by adding JUnit::REQUIRES to the present list of
> requirements, like this:
>
>      # ScalaTest dependencies
>      DEPENDS = ["org.scalatest:scalatest:jar:#{VERSION}"] +
>                 JMock::REQUIRES +
>                 ScalaSpecs::REQUIRES +
>                 ScalaCheck::REQUIRES +
>                 JUnit::REQUIRES
>
> It works.
>
> I bet there is a better way, I tried to open the class in ~/buildr.rb
> and change the constant but I just get warnings that I'm trying to
> change it. I also noticed that the buildr.rb is not picked up if I put
> it in the same directory as my buildfile (the homepage says that
> buildr will look for a buildr.rb in the build-directory and I assumed
> that the build-directory is the same as the directory with the
> buildfile?)
>
> What is the best way to make this kind of patches? I would really like
> to be able to make these changes by just checking in a buildr.rb
> together with my buildfile or something comparably easy. Especially
> since I noticed that you have to be root to change gem-files in
> ubuntu.
>
> I'm probably overlooking something simple and I can't seem to make
> google dig up the correct information for me so I thought I'd ask
> here.
>
> Best regards!
> /Joakim Ohlrogge
>