You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Adrian Petru Dimulescu <ad...@gmail.com> on 2008/10/05 13:12:18 UTC

compiling scala with 1.3.2

Hello, I'm having some trouble understanding how I should organize my
project that would contain java and scala source files. 

Reading the documentation at
http://incubator.apache.org/buildr/languages.html#scala , I organized my
test project as follows. Here what I get with my buildr 1.3.2 :

dadi@zornaila:~/Desktop/work/most-interesting-words$ buildr clean
build ; tree
(in /home/dadi/Desktop/work/most-interesting-words, development)
Cleaning most-interesting-words
Building most-interesting-words
Compiling most-interesting-words
into /home/dadi/Desktop/work/most-interesting-words/target/classes
Testing most-interesting-words
Compiling most-interesting-words:test
into /home/dadi/Desktop/work/most-interesting-words/target/test/classes
Completed in 6.631s
.
|-- buildfile
|-- src
|   |-- main
|   |   |-- java
|   |   |   `-- foaieverde
|   |   |       `-- AJavaClass.java
|   |   `-- scala
|   |       |-- efort
|   |       |   `-- AstaEsteScala.scala
|   |       `-- ex
|   |           |-- DoSmth.scala
|   |           `-- MyScallClass.scala
|   `-- test
|       `-- scala
|           `-- of
|               `-- CeMaiScalaClasa.scala
`-- target
    |-- classes
    |   `-- foaieverde
    |       `-- AJavaClass.class
    `-- test
        `-- classes
            `-- of
                `-- CeMaiScalaClasa.class


My buildfile is :

VERSION_NUMBER = "0.1"
NEXT_VERSION = "0.2"

GROUP = "adrian"
COPYRIGHT = "me"

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

desc "The Most-interesting-words project"
define "most-interesting-words" do

  project.version = VERSION_NUMBER
  project.group = GROUP
  manifest["Implementation-Vendor"] = COPYRIGHT

  package(:jar)
end


So it looks like classes in src/main/scala are not noticed, while
classes in src/test/scala are compiled as expected.



Secondly, I would like to be able to put java and scala files mixed up
in the src/main/java . I thought that adding :

compile.using(:scalac).from('src/main/java')

would allow me to do just that, instead, if I add this directive to my
buildfile I get :

(in /home/dadi/Desktop/work/most-interesting-words, development)
rake aborted!
javac compiler already selected for this project


Thank you for any ideas,
Adrian.


Re: compiling scala with 1.3.2

Posted by Alex Boisvert <bo...@intalio.com>.
Hi Adrian,

Java and Scala sources must currently be in different projects since buildr
only supports one compiler per project and the Scala 2.7.1 compiler only
supports Scala files.   (This will change in 2.7.2 with the addition of Java
support;  we'll update the Buildr support soon).

So right now you'll need a layout similar to:

Buildfile
project1
  src
    main
      java
project2
  src
    main
      scala
    test
      scala

alex


On Sun, Oct 5, 2008 at 4:12 AM, Adrian Petru Dimulescu <
adrian.dimulescu@gmail.com> wrote:

> Hello, I'm having some trouble understanding how I should organize my
> project that would contain java and scala source files.
>
> Reading the documentation at
> http://incubator.apache.org/buildr/languages.html#scala , I organized my
> test project as follows. Here what I get with my buildr 1.3.2 :
>
> dadi@zornaila:~/Desktop/work/most-interesting-words$ buildr clean
> build ; tree
> (in /home/dadi/Desktop/work/most-interesting-words, development)
> Cleaning most-interesting-words
> Building most-interesting-words
> Compiling most-interesting-words
> into /home/dadi/Desktop/work/most-interesting-words/target/classes
> Testing most-interesting-words
> Compiling most-interesting-words:test
> into /home/dadi/Desktop/work/most-interesting-words/target/test/classes
> Completed in 6.631s
> .
> |-- buildfile
> |-- src
> |   |-- main
> |   |   |-- java
> |   |   |   `-- foaieverde
> |   |   |       `-- AJavaClass.java
> |   |   `-- scala
> |   |       |-- efort
> |   |       |   `-- AstaEsteScala.scala
> |   |       `-- ex
> |   |           |-- DoSmth.scala
> |   |           `-- MyScallClass.scala
> |   `-- test
> |       `-- scala
> |           `-- of
> |               `-- CeMaiScalaClasa.scala
> `-- target
>    |-- classes
>    |   `-- foaieverde
>    |       `-- AJavaClass.class
>    `-- test
>        `-- classes
>            `-- of
>                `-- CeMaiScalaClasa.class
>
>
> My buildfile is :
>
> VERSION_NUMBER = "0.1"
> NEXT_VERSION = "0.2"
>
> GROUP = "adrian"
> COPYRIGHT = "me"
>
> repositories.remote << "http://www.ibiblio.org/maven2/"
>
> desc "The Most-interesting-words project"
> define "most-interesting-words" do
>
>  project.version = VERSION_NUMBER
>  project.group = GROUP
>  manifest["Implementation-Vendor"] = COPYRIGHT
>
>  package(:jar)
> end
>
>
> So it looks like classes in src/main/scala are not noticed, while
> classes in src/test/scala are compiled as expected.
>
>
>
> Secondly, I would like to be able to put java and scala files mixed up
> in the src/main/java . I thought that adding :
>
> compile.using(:scalac).from('src/main/java')
>
> would allow me to do just that, instead, if I add this directive to my
> buildfile I get :
>
> (in /home/dadi/Desktop/work/most-interesting-words, development)
> rake aborted!
> javac compiler already selected for this project
>
>
> Thank you for any ideas,
> Adrian.
>
>