buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: NoMethodError : undefined method `java' for Buildr::Eclipse::Java:Module
Date Wed, 23 Mar 2011 19:07:30 GMT
This appears to be a Ruby 1.9.2 bug (or backward compatibility issue?).

Try to ground the Java module as such,

   ::Java::Commands.java  "com.google.gwt.dev.Compiler",
              :classpath => classpath,
              :java_args => ["-Xmx256M"]

alex

On Wed, Mar 23, 2011 at 11:56 AM, Ilya Pyatigorskiy <atamur@gmail.com>wrote:

> Hm. "Buildr::Eclipse" sounds wrong, could you probably try an fqn:
> Buildr::Java::Command.java(...)
>
>
> On Wed, Mar 23, 2011 at 9:43 PM, Geraldo Lopes de Souza
> <geraldo.ls@gmail.com> wrote:
> > ---------- Forwarded message ----------
> > From: Geraldo Lopes de Souza <geraldo.ls@gmail.com>
> > Date: 2011/3/23
> > Subject: Re: NoMethodError : undefined method `java' for
> > Buildr::Eclipse::Java:Module
> > To: Ilya Pyatigorskiy <atamur@gmail.com>
> >
> >
> > Ilya,
> >
> > Thanks for answering, and sharing your buildfile.
> >
> > Unfortunately no, even with Jav::Commands.java it fails like in the
> snipped
> > below:
> >
> >
> > require 'buildr'
> > VERSAO = '0.1'
> >
> > GWT = 'com.google.gwt:gwt-user:jar:2.2.0'
> > GWT_DEV = 'com.google.gwt:gwt-dev:jar:2.2.0'
> > GWT_SERVLET = 'com.google.gwt:gwt-servlet:jar:2.2.0'
> >
> >
> > repositories.remote << "http://repo1.maven.org/maven2/"
> > repositories.remote << "
> > http://repository.jboss.org/nexus/content/groups/public-jboss/"
> >
> >
> > define 'clinica' do
> >  project.version = VERSAO
> >  project.group = 'grupo'
> >
> >  compile.options.target = '1.6'
> >
> >  task :gwtc do
> >    puts "GWT Compile"
> >    Java::Commands.java("com.google.gwt.dev.Compiler")
> >  end
> >
> >  task :build => :gwtc
> >
> >  package(:war).include("war/clinica").
> >                include("war/Clinica.html").
> >                include("war/Clinica.css").
> >                exclude("WEB-INF/classes/app/client")
> > end
> >
> > when i invoke buildr clinica:gwtc it shows
> > NameError : uninitialized constant Buildr::Eclipse::Java::Commands
> > /home/geraldo/test/buildfile:19:in `block (2 levels) in <top (required)>'
> >
> > To be able to compile I called java by myself like this:
> >
> >
> >  task :gwtc do
> >    puts "GWT Compile"
> >    gwt_dependencies = [GWT, GWT_DEV]
> >    classpath_ary = []
> >    gwt_dependencies.each {|d| classpath_ary << artifact(d).to_s}
> >    classpath_ary << compile.source.to_s
> >    cmd = "java -Xmx512m -cp #{classpath_ary.join(':')}
> > com.google.gwt.dev.Compiler app.Clinica"
> >    puts cmd
> >    system cmd
> >  end
> >
> >
> > Regards,
> >
> > Geraldo Lopes de Souza
> >
> >
> >
> > 2011/3/23 Ilya Pyatigorskiy <atamur@gmail.com>
> >
> >> I believe you are missing "Commands" bit:
> >> Java.java should be Java::Commands.java
> >>
> >> Btw you might also be interested in this (a bit more complex) gwt
> >> script. It offers:
> >> 1) auto recompile only when needed (if you can maintain the list of
> >> sources)
> >> 2) draftCompile (faster) in dev env
> >> 3) fetching gwt modules from config
> >>
> >> (I'm an extreme newbie in ruby so there are a few obvious ugly pieces
> >> there, starting with _("target/classes") where i didn't know how to
> >> pass compile.target to java classpath and up to the rm_rf bit)
> >>
> >> --- build.yaml ---
> >> gwt-modules:
> >>  - ru.proj.web.main.MainModule
> >>
> >> --- buildfile ---
> >>    gwt_sources = FileList[_("src/main/java/**/*.gwt.xml"),
> >>                           _("src/main/java/ru/proj/entity/**/*"),
> >>
> _("src/main/java/ru/proj/web/main/client/**/*"),
> >>
> _("src/main/java/ru/proj/web/main/shared/**/*")]
> >>
> >>    gwt_dest = _("target/gwt")
> >>    file gwt_dest => gwt_sources do |t|
> >>      puts "GWT Compile"
> >>      rm_rf gwt_dest # need that to update the timestamp on the dir
> >>      classpath = compile.dependencies + GWT_DEV + GWT_USER +
> >> [_("src/main/resources"), _("src/main/java"), _("src/main/webapp"),
> >> _("target/classes")]
> >>      args = ["-war", gwt_dest, "-localWorkers", "2"]
> >>      if Buildr.environment == "development"
> >>        args << "-draftCompile"
> >>      end
> >>      args << Buildr.settings.build['gwt-modules'].join(" ")
> >>      Java::Commands.java("com.google.gwt.dev.Compiler", args,
> >>        {:classpath => classpath, :java_args => ["-Xmx256M"],
> >> :verbose=>true})
> >>    end
> >>
> >>
> >> On Wed, Mar 23, 2011 at 3:24 AM, Geraldo Lopes de Souza
> >> <geraldo.ls@gmail.com> wrote:
> >> > 2011/3/22 Geraldo Lopes de Souza <geraldo.ls@gmail.com>
> >> >
> >> >> Hi,
> >> >>
> >> >> I'm getting NoMethodError : undefined method `java' for
> >> >> Buildr::Eclipse::Java:Module while trying to execute Java.java.
> >> >>
> >> >> ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
> >> >> buildr (1.4.5)
> >> >>
> >> >> Thanks for help
> >> >>
> >> >> buildfile below
> >> >>
> >> >> require 'buildr'
> >> >> VERSAO = '0.1'
> >> >>
> >> >> GWT = 'com.google.gwt:gwt-user:jar:2.2.0'
> >> >> GWT_DEV = 'com.google.gwt:gwt-dev:jar:2.2.0'
> >> >>
> >> >> repositories.remote << "http://repo1.maven.org/maven2/"
> >> >>
> >> >> layout = Layout.new
> >> >>
> >> >> layout[:source, :main, :java] = "src"
> >> >> layout[:source, :test, :java] = "test"
> >> >> layout[:target, :main, :classes] = "war/WEB-INF/classes"
> >> >> layout[:target, :main] = 'war'
> >> >> layout[:target] = 'war'
> >> >> layout[:target, :test, :classes] = "test-classes"
> >> >>
> >> >> define 'clinica', :layout => layout do
> >> >>  project.version = VERSAO
> >> >>  project.group = 'group'
> >> >>  compile.options.target = '1.6'
> >> >>
> >> >>  compile.with(GWT)
> >> >>
> >> >> task :gwtc do
> >> >>    puts "GWT Compile"
> >> >>    classpath = [GWT, GWT_DEV, "src/app/client", "src/app/shared"]
> >> >>    Java.java  :main => ["com.google.gwt.dev.Compiler"],
> >> >>               :classpath => classpath,
> >> >>               :java_args => ["-Xmx256M"]
> >> >>  end
> >> >>
> >> >>  task :build => :gwtc
> >> >> end
> >> >
> >>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message