Hi all,

I want to define a task which basically calls some existing *ant* task from
scala compiler (scala.tools.ant.ScalaTool).
My build file in project/Build.scala looks like this:
import sbt._
import Keys._

import scala.tools.ant.ScalaTool
//import org.apache.tools.ant.taskdefs.MatchingTask

object SomeBuild extends Build {

val exSettings = Defaults.defaultSettings ++ Seq(
organization := "examples",
name := "ant-task-executor",
version := "0.1",
scalaVersion := "2.9.1",
scalacOptions in Compile ++= Seq("-unchecked", "-deprecation",
"-feature", "-Yoverride-objects"),
javacOptions += "-Xss2M",
resolvers ++= Seq("snapshots" at
"https://oss.sonatype.org/content/repositories/snapshots/")
//logLevel := Level.Debug
)


val generateScripts = TaskKey[Unit]("generate-scripts", "Generate
scripts")
val generateScriptsTask = generateScripts <<= (baseDirectory) map {(base)
=>
val task: ScalaTool = new ScalaTool()
}

lazy val root =
Project("testing",file (".")).settings((exSettings ++
List(generateScriptsTask)):_*)
}


and dependencies file in project/buildSettings.sbt is this:
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.9.2"

libraryDependencies += "org.apache.ant" % "ant" % "1.8.2"

Now, compiling the project is fine, but it fails when running the
'generate-scripts' task with:
sing /home/hubert/.sbt/0.12.1 as sbt dir, -sbt-dir to override.
[info] Loading project definition from
/home/hubert/tmp/repos/sbt-playground/project
[info] Updating
{file:/home/hubert/tmp/repos/sbt-playground/project/}default-113487...
[info] Resolving org.scala-sbt#precompiled-2_10_0-m7;0.12.1 ...
[info] Done updating.
[info] Set current project to ant-task-executor (in build
file:/home/hubert/tmp/repos/sbt-playground/)
generate-scripts
[trace] Stack trace suppressed: run last *:generate-scripts for the full
output.
[error] (*:generate-scripts) java.lang.NoClassDefFoundError:
org/apache/tools/ant/taskdefs/MatchingTask
[error] Total time: 0 s, completed Oct 22, 2012 1:31:00 PM
last
[debug] Running task... Cancelable: false, check cycles: false
java.lang.NoClassDefFoundError: org/apache/tools/ant/taskdefs/MatchingTask
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at SomeBuild$$anonfun$8.apply(Build.scala:23)


which looks like it just doesn't add ant jar to the classpath but well that
was done in project/buildSettings.sbt.
I am probably getting it wrong but I would appreciate any hints.

Thanks,
hubert

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/xSXGTUvnUoYJ.
To post to this group, send email to simple-build-tool@googlegroups.com.
To unsubscribe from this group, send email to simple-build-tool+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupsimple-build-tool @
categoriesscala
postedOct 22, '12 at 11:37a
activeOct 23, '12 at 9:53a
posts4
users3
websitescala-sbt.org
irc#scala

People

Translate

site design / logo © 2022 Grokbase