You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Chris Bozic <cb...@gmail.com> on 2013/10/22 17:51:06 UTC

NoMethodError : undefined method `project=' for #

after upgrading to buildr 1.4.14, I get a new error:

NoMethodError : undefined method `project=' for
#<Rake::FileTask:0x007fe27290a6d0>

The above error occurs on a line in the buildfile where I am attempting to
package(:war).  When I downgrade to buildr 1.4.12 everything works again.
 Has anyone else seen this?  If so, can you help me identify what I am
doing wrong?

Thanks,
Chris

Re: NoMethodError : undefined method `project=' for #

Posted by Alex Boisvert <al...@gmail.com>.
I created an issue and attached a sample project here:
https://issues.apache.org/jira/browse/BUILDR-689


On Tue, Oct 22, 2013 at 1:09 PM, Peter Donald <pe...@realityforge.org>wrote:

> Hi,
>
> That does sound fairly bad. Can you give me steps to reproduce this? I
> tried
>
> $ cat > Gemfile
> source 'https://rubygems.org'
>
> gem 'buildr', '= 1.4.14'
>
> $ cat > buildfile
> define "x" do
>   project.version = '1.0.0'
>   project.group = 'x'
>
>   package(:war)
> end
> $ bundle exec buildr clean package
> (in /Users/peter/Code/tmp/x, development)
> Cleaning x
> Building x
> Packaging x
> Packaging x-1.0.0.war
> Running integration tests...
> Completed in 0.020s
>
>
> And I have also tried a few other variants which all seem to work.
> What version of ruby/os/etc do I need to be running to reproduce?
>
> --
> Cheers,
>
> Peter Donald
>

Re: NoMethodError : undefined method `project=' for #

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

That does sound fairly bad. Can you give me steps to reproduce this? I tried

$ cat > Gemfile
source 'https://rubygems.org'

gem 'buildr', '= 1.4.14'

$ cat > buildfile
define "x" do
  project.version = '1.0.0'
  project.group = 'x'

  package(:war)
end
$ bundle exec buildr clean package
(in /Users/peter/Code/tmp/x, development)
Cleaning x
Building x
Packaging x
Packaging x-1.0.0.war
Running integration tests...
Completed in 0.020s


And I have also tried a few other variants which all seem to work.
What version of ruby/os/etc do I need to be running to reproduce?

-- 
Cheers,

Peter Donald

Re: NoMethodError : undefined method `project=' for #

Posted by Alex Boisvert <al...@gmail.com>.
I can reproduce with a simple project having a package(:war) call.

Peter - FWIW, this patch seems to fix the issue:

smudge ~/g/buildr [trunk] (ruby 1.8.7) $ git di
diff --git a/lib/buildr/core/assets.rb b/lib/buildr/core/assets.rb
index 3566d9c..0a4f145 100644
--- a/lib/buildr/core/assets.rb
+++ b/lib/buildr/core/assets.rb
@@ -75,7 +75,8 @@ module Buildr #:nodoc:
       # Access the asset task
       def assets
         if @assets.nil?
-          @assets = AssetsTask.define_task(project._(:target, :main,
:webapp) => [])
+          @assets =
AssetsTask.define_task("#{[project.name](http://project.name)}:assets_task")
+          @assets.enhance([project._(:target, :main, :webapp)])
           @assets.project = self
           project.task('assets').enhance([@assets])
           project.build.enhance([@assets])

Seems like a severe regression that would affect most web projects.

On Tue, Oct 22, 2013 at 8:51 AM, Chris Bozic <cb...@gmail.com> wrote:

after upgrading to buildr 1.4.14, I get a new error:
>
> NoMethodError : undefined method `project=' for
> #<Rake::FileTask:0x007fe27290a6d0>
>
> The above error occurs on a line in the buildfile where I am attempting to
> package(:war).  When I downgrade to buildr 1.4.12 everything works again.
>  Has anyone else seen this?  If so, can you help me identify what I am
> doing wrong?
>
> Thanks,
> Chris
>

Re: NoMethodError : undefined method `project=' for #

Posted by Chris Bozic <cb...@gmail.com>.
Thanks!  My whole development team really appreciates the great work you are doing on Buildr.

Chris

> On Oct 22, 2013, at 8:02 PM, Peter Donald <pe...@realityforge.org> wrote:
> 
>> On Wed, Oct 23, 2013 at 10:55 AM, Chris Bozic <cb...@gmail.com> wrote:
>> I can confirm that adding "project.assets" allows all of my projects to
>> package successfully.
> 
> great.
> 
> It looks like there was actually multiple bugs. Here is the comment
> from the commit message:
> 
> - The user could define the a task with the same name as the assets
> task as we were lazily creating the task. It is now created before the
> project is defined.
> - The assets integration into the war task was coping the assets from
> the source directories rather than the target directory.
> 
> If you get bitten by the second one you will need to do something like
> the following
> 
> package(:war).tap do |war|
>  war.enhance([assets])
>  if !assets.paths.empty? || File.exist?(_(:source, :main, :webapp))
>    war.include assets.to_s, :as => '.'
>  end
> end
> 
> Sorry about the hassle. I will look at doing another release in the
> near future to address this.
> 
> -- 
> Cheers,
> 
> Peter Donald

Re: NoMethodError : undefined method `project=' for #

Posted by Peter Donald <pe...@realityforge.org>.
On Wed, Oct 23, 2013 at 10:55 AM, Chris Bozic <cb...@gmail.com> wrote:
> I can confirm that adding "project.assets" allows all of my projects to
> package successfully.

great.

It looks like there was actually multiple bugs. Here is the comment
from the commit message:

- The user could define the a task with the same name as the assets
task as we were lazily creating the task. It is now created before the
project is defined.
- The assets integration into the war task was coping the assets from
the source directories rather than the target directory.

If you get bitten by the second one you will need to do something like
the following

package(:war).tap do |war|
  war.enhance([assets])
  if !assets.paths.empty? || File.exist?(_(:source, :main, :webapp))
    war.include assets.to_s, :as => '.'
  end
end

Sorry about the hassle. I will look at doing another release in the
near future to address this.

-- 
Cheers,

Peter Donald

Re: NoMethodError : undefined method `project=' for #

Posted by Chris Bozic <cb...@gmail.com>.
I can confirm that adding "project.assets" allows all of my projects to
package successfully.


On Tue, Oct 22, 2013 at 7:07 PM, Peter Donald <pe...@realityforge.org>wrote:

> Hi,
>
> It looks like I introduced a bug due to lazy construction of the
> assets task. To work around this could you add the following line to
> the problematic project before the packages task and before any other
> tasks the transform into the webapps directory. (At the start of the
> project definition should work)
>
>   # Buildr-689: Force the construction of the assets task
>   project.assets
>
> Does this fix the problem?
>
>
> On Wed, Oct 23, 2013 at 2:51 AM, Chris Bozic <cb...@gmail.com> wrote:
> > after upgrading to buildr 1.4.14, I get a new error:
> >
> > NoMethodError : undefined method `project=' for
> > #<Rake::FileTask:0x007fe27290a6d0>
> >
> > The above error occurs on a line in the buildfile where I am attempting
> to
> > package(:war).  When I downgrade to buildr 1.4.12 everything works again.
> >  Has anyone else seen this?  If so, can you help me identify what I am
> > doing wrong?
> >
> > Thanks,
> > Chris
>
>
>
> --
> Cheers,
>
> Peter Donald
>

Re: NoMethodError : undefined method `project=' for #

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

It looks like I introduced a bug due to lazy construction of the
assets task. To work around this could you add the following line to
the problematic project before the packages task and before any other
tasks the transform into the webapps directory. (At the start of the
project definition should work)

  # Buildr-689: Force the construction of the assets task
  project.assets

Does this fix the problem?


On Wed, Oct 23, 2013 at 2:51 AM, Chris Bozic <cb...@gmail.com> wrote:
> after upgrading to buildr 1.4.14, I get a new error:
>
> NoMethodError : undefined method `project=' for
> #<Rake::FileTask:0x007fe27290a6d0>
>
> The above error occurs on a line in the buildfile where I am attempting to
> package(:war).  When I downgrade to buildr 1.4.12 everything works again.
>  Has anyone else seen this?  If so, can you help me identify what I am
> doing wrong?
>
> Thanks,
> Chris



-- 
Cheers,

Peter Donald