- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Compiler plugin in Maven and Eclipse.
Mon, 2009-07-20, 14:39
Hello all.
My interest is theoretic for now.
(1) Can compiler plugin be specified as maven dependency in pom.xml and
thus be automatically downloaded and used?
(2) If previous answer is "yes", will `mvn eclipse:eclipse` command
configure compiler plugin for use by Eclipse (automatic build)? If
currently impossible, then is it planned?
Mon, 2009-07-20, 15:17
#2
Re: Compiler plugin in Maven and Eclipse.
Zach Cox wrote:
> We've recently introduced Scala into a large Java-based web service
> project and are using both Eclipse and Maven as described in your
> questions. The answer to both is "yes". I can send you relevant
> sections of our pom.xml if you'd like.
Thank you. That would be great. Can you please publish them on mailing
list? I think I'm not the one who would be interested.
Mon, 2009-07-20, 15:37
#3
Re: Re: Compiler plugin in Maven and Eclipse.
I'm certainly not an expert and only started this integration
recently, but here are the relevant sections of our pom:
org.scala-tools
maven-scala-plugin
scala-compile-first
process-resources
add-source
compile
scala-test-compile
process-test-resources
testCompile
org.apache.maven.plugins
maven-compiler-plugin
compile
compile
maven-eclipse-plugin
**/*.scala
ch.epfl.lamp.sdt.core.scalabuilder
ch.epfl.lamp.sdt.core.scalanature
org.eclipse.jdt.launching.JRE_CONTAINER
ch.epfl.lamp.sdt.launching.SCALA_CONTAINER
I can't take credit for writing all of that, we used the following
sources as inspiration:
- http://scala-tools.org/mvnsites/maven-scala-plugin/usage_java.html
- The scala-archetype-simple maven archetype
This allows us to edit/build/run/debug in Eclipse as well as
build/run/test/package using mvn on the command line.
The only issue I haven't resolved is that after doing 'mvn
eclipse:clean eclipse:eclipse' using the above, I have to manually add
our src/main/scala directory as a source folder in Eclipse by
right-clicking it in the Package Explorer and selecting Build Path >
Use as Source Folder. It's annoying but not too bad.
If it matters, we currently use:
- Ubuntu 9.04
- Java 1.6
- Maven 2.0.10
- Eclipse 3.5/3.4
- Scala Eclipse plugin 2.7.5.final
If anyone else has any tips for Scala-Maven-Eclipse integration I'd
love to hear them!
Thanks,
Zach
On Mon, Jul 20, 2009 at 10:07 AM, Dmitry Grigoriev wrote:
> Zach Cox wrote:
>> We've recently introduced Scala into a large Java-based web service
>> project and are using both Eclipse and Maven as described in your
>> questions. The answer to both is "yes". I can send you relevant
>> sections of our pom.xml if you'd like.
>
> Thank you. That would be great. Can you please publish them on mailing
> list? I think I'm not the one who would be interested.
>
Mon, 2009-07-20, 15:47
#4
Re: Compiler plugin in Maven and Eclipse.
On Mon, Jul 20, 2009 at 3:00 PM, Zach Cox wrote:
> We've recently introduced Scala into a large Java-based web service
> project and are using both Eclipse and Maven as described in your
> questions. The answer to both is "yes". I can send you relevant
> sections of our pom.xml if you'd like.
I'd be extremely grateful if you could update the wiki here,
http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven
Cheers,
Miles
Mon, 2009-07-20, 16:07
#5
Re: Compiler plugin in Maven and Eclipse.
Ah I hadn't seen that wiki page before, thanks Miles! I'll update it.
I also just resolved the "manually add src/main/scala as a source
folder" problem using the build-helper-maven-plugin as described in
http://groups.google.com/group/liftweb/browse_thread/thread/3dac7002f9e5....
Just add this additional plugin to the xml I posted earlier:
org.codehaus.mojo
build-helper-maven-plugin
add-source
generate-sources
add-source
src/main/scala
add-test-source
generate-sources
add-test-source
src/test/scala
Now I can just do 'mvn eclipse:clean eclipse:eclipse' on cli, hit F5
in Eclipse to refresh the project, and all is well.
Thanks,
Zach
On Mon, Jul 20, 2009 at 10:37 AM, Miles Sabin wrote:
> On Mon, Jul 20, 2009 at 3:00 PM, Zach Cox wrote:
>> We've recently introduced Scala into a large Java-based web service
>> project and are using both Eclipse and Maven as described in your
>> questions. The answer to both is "yes". I can send you relevant
>> sections of our pom.xml if you'd like.
>
> I'd be extremely grateful if you could update the wiki here,
>
> http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven
>
> Cheers,
>
>
> Miles
>
> --
> Miles Sabin
> tel: +44 (0)7813 944 528
> skype: milessabin
> http://www.chuusai.com/
> http://twitter.com/milessabin
>
Mon, 2009-07-20, 16:37
#6
Re: Compiler plugin in Maven and Eclipse.
> I'd be extremely grateful if you could update the wiki here,
>
> http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven
Updated. Please let me know if the instructions under "Scala IDE for
Eclipse with Maven CLI" don't work and I'll try to fix them.
Thanks,
Zach
Mon, 2009-07-20, 16:47
#7
Re: Compiler plugin in Maven and Eclipse.
On Mon, Jul 20, 2009 at 4:34 PM, Zach Cox wrote:
>> I'd be extremely grateful if you could update the wiki here,
>>
>> http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven
>
> Updated. Please let me know if the instructions under "Scala IDE for
> Eclipse with Maven CLI" don't work and I'll try to fix them.
Fantastic ... thanks!
Cheers,
Miles
Mon, 2009-07-20, 17:07
#8
Re: Compiler plugin in Maven and Eclipse.
Zach Cox wrote:
> here are the relevant sections of our pom:
Hm. My question was about "scala compiler plugin" -
http://www.scala-lang.org/node/140. Either you misunderstood my question
or I misunderstand your answer.
Mon, 2009-07-20, 17:17
#9
Re: Re: Compiler plugin in Maven and Eclipse.
Heh - yeah I totally misunderstood your original question. I thought
you were asking about Maven-Eclipse integration. I know nothing about
creating plugins for the Scala compiler. Sorry!
But hey, at least a wiki page got updated in the process of our confusion. :)
On Mon, Jul 20, 2009 at 12:00 PM, Dmitry Grigoriev wrote:
> Zach Cox wrote:
>> here are the relevant sections of our pom:
>
> Hm. My question was about "scala compiler plugin" -
> http://www.scala-lang.org/node/140. Either you misunderstood my question
> or I misunderstand your answer.
>
>
Tue, 2009-07-21, 01:17
#10
Re: Compiler plugin in Maven and Eclipse.
Don't know about configuring eclipse (I use m2eclipse, haven't used mvn
eclipse:eclipse in a couple of years), but the relevant pom section for
compiler plugins is here:
org.scala-tools
maven-scala-plugin
org.villane.vecmath
vecmath-optimizer
0.1.0-SNAPSHOT
You might also want to read the docs on the maven-scala-plugin site:
http://scala-tools.org/mvnsites/maven-scala-plugin/usage_scalac_plugins....
Dmitry Grigoriev wrote:
> Hello all.
>
> My interest is theoretic for now.
>
> (1) Can compiler plugin be specified as maven dependency in pom.xml and
> thus be automatically downloaded and used?
>
> (2) If previous answer is "yes", will `mvn eclipse:eclipse` command
> configure compiler plugin for use by Eclipse (automatic build)? If
> currently impossible, then is it planned?
>
Tue, 2009-07-21, 02:17
#11
Re: Compiler plugin in Maven and Eclipse.
I would certainly love to integrate this with the eclipse plugin. Such a feature would require either a custom hack to the mvn eclipse:eclipse goal, or would have to live as a "plugin" of either m2e or IAM. Although I'm able to create a plugin for IAM, I am seriously limited in resources currently. Things that aren't directly helping my job have been falling into my backburner.
If anyone is interested in undertaking this, I'd be more than willing to help!
Also, as a side note, to fix the src/main/scala not becoming a source directory when running mvn eclipse:eclipse, you need to configure the "build-helper-plugin" in your pom and specify src/main/scala. This is currently the only way to resolve that issue (as we don't have much control/sway over the maven-eclipse-plugin).
- Josh
On Mon, Jul 20, 2009 at 8:10 PM, Erkki Lindpere <erkki@lap.ee> wrote:
If anyone is interested in undertaking this, I'd be more than willing to help!
Also, as a side note, to fix the src/main/scala not becoming a source directory when running mvn eclipse:eclipse, you need to configure the "build-helper-plugin" in your pom and specify src/main/scala. This is currently the only way to resolve that issue (as we don't have much control/sway over the maven-eclipse-plugin).
- Josh
On Mon, Jul 20, 2009 at 8:10 PM, Erkki Lindpere <erkki@lap.ee> wrote:
Don't know about configuring eclipse (I use m2eclipse, haven't used mvn eclipse:eclipse in a couple of years), but the relevant pom section for compiler plugins is here:
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<compilerPlugins>
<compilerPlugin>
<groupId>org.villane.vecmath</groupId>
<artifactId>vecmath-optimizer</artifactId>
<version>0.1.0-SNAPSHOT</version>
</compilerPlugin>
</compilerPlugins>
</configuration>
</plugin>
You might also want to read the docs on the maven-scala-plugin site:
http://scala-tools.org/mvnsites/maven-scala-plugin/usage_scalac_plugins.html
Dmitry Grigoriev wrote:
Hello all.
My interest is theoretic for now.
(1) Can compiler plugin be specified as maven dependency in pom.xml and
thus be automatically downloaded and used?
(2) If previous answer is "yes", will `mvn eclipse:eclipse` command
configure compiler plugin for use by Eclipse (automatic build)? If
currently impossible, then is it planned?
Tue, 2009-07-21, 22:37
#12
Re: Compiler plugin in Maven and Eclipse.
Thank you.
I never used m2eclipse, does it correctly configure Eclipse scala
compiler from the maven configuration you showed?
Erkki Lindpere wrote:
> Don't know about configuring eclipse (I use m2eclipse, haven't used mvn
> eclipse:eclipse in a couple of years), but the relevant pom section for
> compiler plugins is here:
>
>
> org.scala-tools
> maven-scala-plugin
>
>
>
> org.villane.vecmath
> vecmath-optimizer
> 0.1.0-SNAPSHOT
>
>
>
>
>
> You might also want to read the docs on the maven-scala-plugin site:
> http://scala-tools.org/mvnsites/maven-scala-plugin/usage_scalac_plugins....
Wed, 2009-07-22, 22:37
#13
Re: Re: Compiler plugin in Maven and Eclipse.
Unfortunately, it doesn't automatically configure Scala at all.
Dmitry Grigoriev wrote:
> Thank you.
>
> I never used m2eclipse, does it correctly configure Eclipse scala
> compiler from the maven configuration you showed?
>
> Erkki Lindpere wrote:
>
>> Don't know about configuring eclipse (I use m2eclipse, haven't used mvn
>> eclipse:eclipse in a couple of years), but the relevant pom section for
>> compiler plugins is here:
>>
>>
>> org.scala-tools
>> maven-scala-plugin
>>
>>
>>
>> org.villane.vecmath
>> vecmath-optimizer
>> 0.1.0-SNAPSHOT
>>
>>
>>
>>
>>
>> You might also want to read the docs on the maven-scala-plugin site:
>> http://scala-tools.org/mvnsites/maven-scala-plugin/usage_scalac_plugins....
>>
>
>
We've recently introduced Scala into a large Java-based web service
project and are using both Eclipse and Maven as described in your
questions. The answer to both is "yes". I can send you relevant
sections of our pom.xml if you'd like.
Thanks,
Zach
On Mon, Jul 20, 2009 at 9:40 AM, Dmitry Grigoriev wrote:
> Hello all.
>
> My interest is theoretic for now.
>
> (1) Can compiler plugin be specified as maven dependency in pom.xml and
> thus be automatically downloaded and used?
>
> (2) If previous answer is "yes", will `mvn eclipse:eclipse` command
> configure compiler plugin for use by Eclipse (automatic build)? If
> currently impossible, then is it planned?
>