Getting play error in the Scala ant build

2019-08-02 02:44发布

I am using play 1.2.7 and Following is my build script for scala files:

<target name="init">
        <property
        name="scala-library.jar"
        value="${env.SCALA_HOME}/lib/scala-library.jar"
         />
        <path id="build.classpath">
            <pathelement location="${lib}/anorm_2.10-2.3.1.jar"/>
            <pathelement location="${lib}/bootstrap-3.2.0.jar"/>
            <pathelement location="${lib}/jbcrypt-0.3m.jar"/>
            <pathelement location="${lib}/play-1.2.7.jar"/>
            <pathelement location="${lib}/play-ws_2.10-2.3.1.jar"/>
            <pathelement location="${lib}/webjars-play_2.10-2.3.0.jar"/>

            <fileset dir="${env.PLAY_HOME}/framework">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${env.PLAY_HOME}/framework/lib">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="lib">
                <include name="*.jar"/>
            </fileset>

            <pathelement location="${scala-library.jar}"   />
            <pathelement location="${env.PLAY_HOME}/framework/play-1.2.7.jar"/>
            <!--<pathelement location="${your.path}"   />-->
            <pathelement location="${build.dir}"   />
        </path>
        <taskdef resource="scala/tools/ant/antlib.xml">
            <classpath>
                <pathelement location="${env.SCALA_HOME}/lib/scala-compiler.jar"/>
                <pathelement location="${env.SCALA_HOME}/lib/scala-reflect.jar"/>
                <pathelement location="${scala-library.jar}"/>
                <pathelement location="${env.PLAY_HOME}/framework/play-1.2.7.jar"/>

            </classpath>
        </taskdef>
    </target>

    <target name="build" depends="init">
        <mkdir dir="${build.dir}"/>
        <echo>build.dir:  ${build.dir}</echo>
        <scalac srcdir="/home/vf-root/workspaces/partnerspace/ipp-partner"
                destdir="${build.dir}"
                classpathref="build.classpath">
        </scalac>
    </target> 

I have following imports in my scala files:

import play.api._
import models._
import anorm._
import play.api.mvc.Filter
import play.api.mvc.RequestHeader
import play.api.mvc.Result
import scala.concurrent.Future
import play.api.mvc.SimpleResult
import play.api.mvc.WithFilters
import play.Configuration
import filter.UrlRewritingFilter
import play.api.libs.Crypto

When I am running this build script I found exception for play that is getting used in the .scala file

error: object mvc is not a member of package play.api
   [scalac] import play.api.mvc.Filter
 error: object Configuration is not a member of package play
   [scalac] import play.Configuration
 error: object Logger is not a member of package play.api
   [scalac] import play.api.Logger
error: object data is not a member of package play.api
   [scalac] import play.api.data._

I have added play jars in the classpath but still getting these errors. Can anyone please give me any pointer how to fix these errors?

0条回答
登录 后发表回答