2

I have been using version 1.3.2 of commons-io before for project A. On project B I used the newest version 2.4. Now I want to add Project B's JAR as library to project A. Since project B uses functionalities that didn't exist yet in commons-io version 1.3.2 I updated the pom.xml of project A to use version 2.4 for commons-io:

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

Now when I try to run the code in project A which calls libraries in project B, I'm getting

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z

since IntelliJ didn't seem to realize that the libraries have updated.

I tried re-importing the Maven dependencies and deleting the local directory containing the commons-io libraries C:\Users\Name\.m2\repository\commons-io but that didn't work either. How do I fix this and make IntelliJ become aware of the updated classes such as FileUtils? Their decompiler for example shows me the old byte code version still when I peek definitions but it is supposed to update it according to the pom.xml.

I have import Maven projects automatically checked by the way.

Community
  • 1
  • 1
BullyWiiPlaza
  • 17,329
  • 10
  • 113
  • 185
  • 1
    Can you check your maven configuration within IntelliJ to check whether you have the correct local repo? After that, delete the commons-io directory again and confirm that it's gone, then go back to idea and click the reimport button on the maven window again. Then, check if the commons-io directory has been recreated and see what it contains. If it has more than you expect, try `mvn dependency:tree` on the command line, and check for the commons-io dependencies to see if you understand where each version is coming from. Then, report your results back here. – Software Engineer Nov 15 '15 at 00:36
  • @EngineerDollery: I resolved the issue. The exported JAR from project B actually contained an old version of `commons-io` which was prioritized over the one in project A since it was bundled. – BullyWiiPlaza Nov 16 '15 at 15:50

1 Answers1

4

Right click on the project, go to Maven -> Reimport. This should show all the maven imports and update all the new jars.

Somadev
  • 384
  • 3
  • 4