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: Classpath Issue
Date Fri, 06 Nov 2009 16:11:02 GMT
Hi Damien,

Here's a refactored (working) version of your Buildfile,

VERSION_NUMBER = "1.0.0"

repositories.remote << "http://www.ibiblio.org/maven2/"

def preverify
  #system 'preverify #{'
  puts 'need to invoke J2ME preverifier here'
end

desc "The Mbws-sib-console project"
define "MBWS-SIB-CONSOLE" do
  project.version = VERSION_NUMBER
  project.group = "MBWS-SIB-CONSOLE"

  compile.options.target = '1.1'
  compile.options.source = '1.3'

  desc "IM3910 libs"
  define "IM3910" do
    compile.from(_('IM3910v14'))
    package :jar
    compile { preverify }
  end

  compile.with project('IM3910')
  compile.from(_('DefaultComponent/DefaultConfig/mbws'))
  compile { preverify }
end

Couple notes,

   - Use _('path/to/something') for all your paths so they get correctly
   resoved relative to your project
   - compile.with project('IM3910)' will use the exported project artifact
   (in this case the .jar);  if you don't generate a jar then you need to do
   compile.with project('IM3910').compile.target
   - compile.options are inherited so you don't have to repeat them in
   sub-projects

Hope this helps,
alex


On Thu, Nov 5, 2009 at 9:01 PM, Damien Cahill <dcahill@metalstorm.com>wrote:

> Hi Guys,
>
> I'm having one of those days and apologies in advance if this turns out to
> be a real dumb question.
>
> Ok so I'm using a range of different tools at different stages of
> development in my work on a J2ME project.  I'm at a cross roads of whether
> to begin to learn Ant or skip ahead and use something cool like Buildr.
> Personally I'd rather spend the time writing ruby than battling XML.
>
> So, I have my J2ME class library from my hardware vendor and I have my
> three
> little classes that I've just generated from our UML code generation tool.
> Now I want Buildr to 1) build the core libs 2) preverify these libs using
> the Sun Wireless Toolkit (WTK) 3) build my generated classes 4) wrap the
> final thing into a jar 5) (optional) ftp the whole thing to the dev board
> on
> my desk.
>
> Now I've managed to get my buildfile to compile the libs just fine.  At the
> moment I'm skipping step 2 and just puts'ing some text for the post compile
> step.  Now when it comes to compile my 3 little basic classes I get a
> classic classpath issue (shown  below) of can't find package.  I've done a
> whole day of reading and I can't quite work out what I'm doing wrong.  I
> figured out how to get around the ./src/main/java issue using the
> compile.from method.  I figured out how to add steps to the compile method
> (as shown with preverify).  I just can't figure out why Buildr isn't
> setting
> the classpath to the output of the subproject build task.  I've run Buildr
> using the --trace option and it clearly shows me that it is not setting the
> classpath correctly (ie, the target/classes directory is not included) when
> it invokes javac.  Apart from the build file shown below I've tried having
> the projects defined separately (not in the master projects block/closure)
> and using the compile.with option (as shown in the commented out line) but
> this also doesn't work.
>
> Any and all help will be greatly appreciated.
>
> Thanks in advance :)
>
> # Generated by Buildr 1.3.5, change to your liking
> # Version number for this release
> VERSION_NUMBER = "1.0.0"
> # Group identifier for your projects
> GROUP = "MBWS-SIB-CONSOLE"
> COPYRIGHT = ""
>
> # Specify Maven 2.0 remote repositories here, like this:
> repositories.remote << "http://www.ibiblio.org/maven2/"
>
> desc "The Mbws-sib-console project"
> define "MBWS-SIB-CONSOLE" do
>
>  project.version = VERSION_NUMBER
>  project.group = GROUP
>  manifest["Implementation-Vendor"] = COPYRIGHT
>  compile.options.target = '1.1'
>  compile.options.source = '1.3'
>  #compile.with  project('IM3910')
>  compile.from('DefaultComponent/DefaultConfig/mbws')
>
>  compile { preverify }
>
>  desc "IM3910 libs"
>  define "IM3910" do
>                compile.options.target = '1.1'
>                compile.options.source = '1.3'
>                compile.from('IM3910v14')
>                compile.into('target/classes')
>                #package :jar
>                compile { preverify }
>  end
> end
>
> def preverify
>        #system 'preverify #{'
>        puts 'need to invoke J2ME preverifier here'
> end
>
> ---Results----
>
> T:\RahpsodyWorkspace\MBWS-SIB-CONSOLE>buildr build
> (in T:/RahpsodyWorkspace/MBWS-SIB-CONSOLE, development)
> Building MBWS-SIB-CONSOLE
> Compiling MBWS-SIB-CONSOLE:IM3910 into target/classes
> need to invoke J2ME preverifier here
> Compiling MBWS-SIB-CONSOLE into
> T:/RahpsodyWorkspace/MBWS-SIB-CONSOLE/target/cla
> sses
>
> T:\RahpsodyWorkspace\MBWS-SIB-CONSOLE\DefaultComponent\DefaultConfig\mbws\si
> b\co
> nsole\SpiDevice.java:16: package se.imsys.comm does not exist
> import se.imsys.comm.SPI;
>                    ^
>
> T:\RahpsodyWorkspace\MBWS-SIB-CONSOLE\DefaultComponent\DefaultConfig\mbws\si
> b\co
> nsole\SpiDevice.java:26: cannot find symbol
> symbol: class SPI
> public abstract class SpiDevice extends SPI {
>                                        ^
> 2 errors
> Buildr aborted!
> Failed to compile, see errors above
>
>
> Damien Cahill
> Electronics Engineer
> Metal Storm Ltd.
> www.metalstorm.com
> p.61 7 3123 4725
> f.61 7 3217 0899
> m.61 4 1504 2779
>
>

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