10

我想导入 org.apache.commons.io 但我收到了这个错误:

[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 找不到包 org.apache.commons.io 。如何将 apache io 添加为依赖项?

4

1 回答 1

35

添加依赖项

  1. 编辑项目 Build.scala 文件:/project/Build.scala并添加依赖项commons-io

    val appDependencies = Seq(
       // Add your project dependencies here,
      "commons-io" % "commons-io" % "2.4"
    )
    
  2. 使用播放控制台检查依赖关系已解决或不使用命令:play dependencies

提示:如果您不熟悉 SBT 语法 mvnrepository.com 允许您在SBT选项卡中复制正确的一个:commons-io 示例

于 2012-06-23T05:25:38.087 回答