本文介绍了将Apache通用依赖项添加到Play Framework 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想导入org.apache.commons.io,但出现此错误:
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 -
播放找不到包org.apache.commons.io.如何添加apache io作为依赖项?
Play can't find package org.apache.commons.io .How can i add apache io as a dependency ?
推荐答案
添加依赖项
-
编辑项目Build.scala文件:
/project/Build.scala
并添加commons-io
val appDependencies = Seq(
// Add your project dependencies here,
"commons-io" % "commons-io" % "2.4"
)
使用播放控制台检查依赖项已解决或不使用命令:play dependencies
提示:如果您不熟悉SBT语法,则mvnrepository.com允许您在SBT
选项卡中复制适当的代码:常见的io样本
Tip: If you're not familiar with SBT syntax mvnrepository.com allows you to copy proper one in SBT
tab: commons-io sample
这篇关于将Apache通用依赖项添加到Play Framework 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!