Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Apache common dependency to Play Framework 2.0

i want to import org.apache.commons.io but i'm getting this error:

[info] Compiling 1 Java source to /home/ghost/Bureau/app/play-2.0.1/waf/target/scala-2.9.1/classes...
[error] /home/ghost/Bureau/app/play-2.0.1/waf/app/controllers/Application.java:9: error: package org.apache.commons.io does not exist
[error]     import org.apache.commons.io.*;
[error]     ^
[error] /home/ghost/Bureau/app/play-2.0.1/waf/app/controllers/Application.java:41: error: cannot find symbol
[error]                 FileUtils.copyFile(file, destinationFile);
[error]                 ^
[error]   symbol:   variable FileUtils
[error]   location: class Application
[error] 2 errors
[error] {file:/home/ghost/Bureau/app/play-2.0.1/waf/}waf/compile:compile: javac returned nonzero exit code
[error] application - 

Play can't find package org.apache.commons.io . How can i add apache io as a dependency ?

like image 440
Mooh Avatar asked Jun 23 '12 03:06

Mooh


People also ask

How do you add a dependency in play framework?

Unmanaged dependencies work like this: create a lib/ directory in the root of your project and then add jar files to that directory. They will automatically be added to the application classpath. There's not much else to it. There's nothing to add to build.

Which component is responsible for building play framework?

Play Framework is an open-source web application framework which follows the model–view–controller (MVC) architectural pattern. It is written in Scala and usable from other programming languages that are compiled to JVM bytecode, e.g. Java.


1 Answers

To add the dependencies

  1. Edit project Build.scala file : /project/Build.scala and add dependency for commons-io

    val appDependencies = Seq(
       // Add your project dependencies here,
      "commons-io" % "commons-io" % "2.4"
    )
    
  2. using play console check dependency resolved or not use command: play dependencies

Tip: If you're not familiar with SBT syntax mvnrepository.com allows you to copy proper one in SBT tab: commons-io sample

like image 119
jittakal Avatar answered Sep 25 '22 02:09

jittakal