- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Problem compiling using scala.swing from Maven plugin
Sat, 2009-02-28, 23:09
I'm trying to build an application generated from the scala-archetype-simple
Maven archetype, but I am having problems compiling any code that tries to
import scala.swing. I get the following error:
[WARNING]
/Users/wellman/dev/scala/swingtest/src/main/scala/com/danielwellman/Gui.scala:3:
error: value swing is not a member of package scala
[WARNING] import scala.swing._
[WARNING] ^
[WARNING] one error found
When I try to compile this code using fsc, it compiles without a problem.
I'm using Scala 2.7.3 (via MacPorts), Java 1.5.0_16, Maven version 2.0.9.
More details:
Gui.scala
----------
package com.danielwellman
import scala.swing._
object Gui extends SimpleGUIApplication {
def top = new MainFrame()
}
Here's my pom.xml:
4.0.0
com.danielwellman
swingtest
1.0-SNAPSHOT
2008
2.7.3
scala-tools.org
Scala-Tools Maven2 Repository
http://scala-tools.org/repo-releases
scala-tools.org
Scala-Tools Maven2 Repository
http://scala-tools.org/repo-releases
org.scala-lang
scala-library
${scala.version}
junit
junit
4.4
test
org.specs
specs
1.2.5
test
src/main/scala
src/test/scala
org.scala-tools
maven-scala-plugin
compile
testCompile
${scala.version}
-target:jvm-1.5
org.apache.maven.plugins
maven-eclipse-plugin
true
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
org.scala-tools
maven-scala-plugin
${scala.version}
Here's the output of running "mvn compile"
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Unnamed - com.danielwellman:swingtest:jar:1.0-SNAPSHOT
[INFO] task-segment: [compile]
[INFO]
------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [scala:compile {execution: default}]
[INFO] suggestion: remove the scalaVersion from pom.xml
[ERROR] /Users/wellman/dev/scala/swingtest/src/main/scala
[INFO] Compiling 2 source files to
/Users/wellman/dev/scala/swingtest/target/classes
[WARNING]
/Users/wellman/dev/scala/swingtest/src/main/scala/com/danielwellman/Gui.scala:3:
error: value swing is not a member of package scala
[WARNING] import scala.swing._
[WARNING] ^
[WARNING] one error found
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] command line returned non-zero value:1
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Sat Feb 28 17:08:18 EST 2009
[INFO] Final Memory: 8M/16M
[INFO]
------------------------------------------------------------------------
Sun, 2009-03-01, 02:37
#2
Re: Problem compiling using scala.swing from Maven plugin
Great, that does it. Thank you - I hadn't thought that it might not be part
of the standard library.
Dan
David Bernard-3 wrote:
>
> scala.swing is not part of the scala-library.
> add to your pom.xml
>
>
> org.scala-lang
> scala-swing
> ${scala.version}
>
>
>
add to your pom.xml
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-swing</artifactId>
<version>${scala.version}</version>
</dependency>
On Sat, Feb 28, 2009 at 23:09, Daniel Wellman <etldan@gmail.com> wrote: