build compile maven tests Jahia 7.3 Jahia 8

Error when upgrading Jahia version in a custom module pom.xml

Question

When the Jahia version inside the pom.xml of a module is upgraded, it could lead to some errors on the build. Specially when automatic tests are active. The error(s) are spring errors, beans cannot be instantiated like

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'pathResolver' is defined

Answer

The problem comes from a version conflict. Usually, wrong commons-io version is used in junit. To overwrite it an additional dependency would be needed to commons-io in the version from the current Jahia. E.g. For Jahia 7.3.9.0 it would be:

<dependency>
     <groupId>commons-io</groupId>
     <artifactId>commons-io</artifactId>
     <version>2.8.0</version>
     <scope>provided</scope>     
</dependency>

After adding the dependency, the tests should work as expected on the next built.