If you are asking for how to specify the dependency on Commons-IO in the pom.xml:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
Answer from Thilo on Stack OverflowIf you are asking for how to specify the dependency on Commons-IO in the pom.xml:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
You need to add commons-io to your dependencies.
Here you can find snippets and choose version you need.
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils, maven pom.xml wa - Stack Overflow
Apache Common IO FileUtils Issue - Stack Overflow
maven - Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils - Stack Overflow
Unable to import maven dependency added in pom.xml
MoJoExecutionException is exceptions by maven plugins to signle something is wrong. reading you error stacktrace looks like your tomcat plugin is complaining about class not found at runtime.
can you please share your complete pom.xml. Have you added tomcat plugin ?
Also add below dependency
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
Thanks everyone.
I finally partly found my own problem.

I changed dubbo version from 2.8.4 (which I maven packaged from github myself) to 2.5.3, which turned out to work. There is no need to use Common IO jar as dependency any more whether the module is packaged as jar or war here. maybe can be helpful to someone else who happens to run to the same issue
Version 1.3.2 doesn't have this method, use a newer version of commons-io
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
Check the FileUtils 2.4 javadoc
Turns out I was adding the Tomcat library files as well as the JRE library files to my project. Because when I deleted commons-io from my POM, I still had FileUtils available.
I had to get rid of the Tomcat library files from my build path, and once I put commons-io back in, it worked.
If it compiles fine but throws the exception when running, it means the dependency was on classpath when compiling but not when running the code.
Maven is responsible for compile classpath, and did provide the dependency on compile time. You'll have to check how you run the application and make sure the maven dependencies are also on the runtime classpath - that has nothing to do with Maven, unless you run the code as a part of unit tests.
you can try adding library to your classpath ex:
javac -classpath fileUtillibraywhatever.jar YourClass.java
EDIT:
If your main class is in a package
package com.yourpackage.test;
public class YourClass
{}
then
javac -classpath fileUtillibraywhatever.jar com/yourpackage/test/YourClass.java
and run
java -classpath fileUtillibraywhatever.jar com/yourpackage/test/YourClass
I hope it helps.. If you are working with iDE https://wiki.eclipse.org/FAQ_How_do_I_add_an_extra_library_to_my_project's_classpath%3F
I am using "import org.apache.commons.io.FileUtils"
This is my pom.xml
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
</dependency><dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
</dependency>