This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Problem compiling using scala.swing from Maven plugin

2 replies
Daniel Wellman
Joined: 2009-02-02,
User offline. Last seen 1 year 48 weeks ago.

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]
------------------------------------------------------------------------

david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
Re: Problem compiling using scala.swing from Maven plugin
scala.swing is not part of the scala-library.
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:

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:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.danielwellman</groupId>
 <artifactId>swingtest</artifactId>
 <version>1.0-SNAPSHOT</version>
 <inceptionYear>2008</inceptionYear>
 <properties>
   <scala.version>2.7.3</scala.version>
 </properties>

 <repositories>
   <repository>
     <id>scala-tools.org</id>
     <name>Scala-Tools Maven2 Repository</name>
     <url>http://scala-tools.org/repo-releases</url>
   </repository>
 </repositories>

 <pluginRepositories>
   <pluginRepository>
     <id>scala-tools.org</id>
     <name>Scala-Tools Maven2 Repository</name>
     <url>http://scala-tools.org/repo-releases</url>
   </pluginRepository>
 </pluginRepositories>

 <dependencies>
   <dependency>
     <groupId>org.scala-lang</groupId>
     <artifactId>scala-library</artifactId>
     <version>${scala.version}</version>
   </dependency>
   <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.4</version>
     <scope>test</scope>
   </dependency>
   <dependency>
     <groupId>org.specs</groupId>
     <artifactId>specs</artifactId>
     <version>1.2.5</version>
     <scope>test</scope>
   </dependency>
 </dependencies>

 <build>
   <sourceDirectory>src/main/scala</sourceDirectory>
   <testSourceDirectory>src/test/scala</testSourceDirectory>
   <plugins>
     <plugin>
       <groupId>org.scala-tools</groupId>
       <artifactId>maven-scala-plugin</artifactId>
       <executions>
         <execution>
           <goals>
             <goal>compile</goal>
             <goal>testCompile</goal>
           </goals>
         </execution>
       </executions>
       <configuration>
         <scalaVersion>${scala.version}</scalaVersion>
         <args>
           <arg>-target:jvm-1.5</arg>
         </args>
       </configuration>
     </plugin>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-eclipse-plugin</artifactId>
       <configuration>
         <downloadSources>true</downloadSources>
         <buildcommands>
           <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
         </buildcommands>
         <additionalProjectnatures>
           <projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
         </additionalProjectnatures>
         <classpathContainers>

<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>

<classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>
         </classpathContainers>
       </configuration>
     </plugin>
   </plugins>
 </build>
 <reporting>
   <plugins>
     <plugin>
       <groupId>org.scala-tools</groupId>
       <artifactId>maven-scala-plugin</artifactId>
       <configuration>
         <scalaVersion>${scala.version}</scalaVersion>
       </configuration>
     </plugin>
   </plugins>
 </reporting>
</project>


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]
------------------------------------------------------------------------

--
View this message in context: http://www.nabble.com/Problem-compiling-using-scala.swing-from-Maven-plugin-tp22267415p22267415.html
Sent from the Scala - User mailing list archive at Nabble.com.


Daniel Wellman
Joined: 2009-02-02,
User offline. Last seen 1 year 48 weeks ago.
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}
>
>
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland