Java 包 org.apache.commons.io 不存在错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21673618/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 10:01:33  来源:igfitidea点击:

package org.apache.commons.io does not exist error

javaapacheantlucene

提问by samnaction

I am compiling a .java file using ant compiler. I am getting the following errror "package org.apache.commons.io does not exist error"

我正在使用 ant 编译器编译 .java 文件。我收到以下错误“包 org.apache.commons.io 不存在错误”

I downloaded the apache Commons IO binaries and pasted the .jar files in "C:\Program Files\Java\jdk1.7.0_51\lib\missioncontrol\plugins "

我下载了 apache Commons IO 二进制文件并将 .jar 文件粘贴到“C:\Program Files\Java\jdk1.7.0_51\lib\missioncontrol\plugins”

Any help. Do I need to modify the classpath of my build xml file?

任何帮助。我需要修改我的构建 xml 文件的类路径吗?

<target name="compile" description="Compile source code">
<mkdir dir="${build.dir}/classes"/>
 <javac includeantruntime="false"
    srcdir="src"
       destdir="${build.dir}/classes"
       classpathref="classpath"
       encoding="UTF8"
       debug="on"
       deprecation="on">
  <include name="**/*.java"/>
  <exclude name="**/NutchExample.java"/>
 </javac>

 <copy todir="${build.dir}/classes/lia/tools">
   <fileset dir="src/lia/tools" excludes="**/*.java"/>
 </copy>
</target>

回答by orientchen1978

Go to: http://commons.apache.org/proper/commons-io/download_io.cgiDownload: commons-io-2.4-bin.zip Unzip and find commons-io-2.4.jar in folder commons-io-2.4

前往:http://commons.apache.org/proper/commons-io/download_io.cgi 下载:commons-io-2.4-bin.zip 解压并在commons-io-2.4文件夹中找到commons-io-2.4.jar

回答by puppyDomminatedWorld

I was having same issue then realized that the version of commons-io getting picked up was lower than what I need (2.4)....I need to Override the already managed version as below to get the right one picked up:

我遇到了同样的问题,然后意识到获取的 commons-io 版本低于我需要的版本(2.4)。...我需要覆盖如下已管理的版本以获取正确的版本:

<dependency>
     <groupId>commons-io</groupId>
     <artifactId>commons-io</artifactId>
     <version>2.4</version>
 </dependency>