New Gradle version creates conflict with depedency

I have a simple build script (shorted for clarity) which uses Guava as a dependency

group 'test'
version '0.1.0'

apply plugin: 'java'
apply plugin: 'application'

sourceCompatibility = 1.8
targetCompatibility = 1.8

mainClassName = 'Test'

repositories {mavenCentral()}
task wrapper(type: Wrapper) {gradleVersion = '3.5'}
dependencies {compile 'com.google.guava:guava:21.0'}

When running this code:

public class Test {
    public static void main(String[] args) {
        LoadingCache<Long, String> applicantCache = CacheBuilder.newBuilder()
                .maximumSize(30000)
                .expireAfterAccess(31, TimeUnit.DAYS)
                .build(new CacheLoader<Long, String>() {
                    @Override
                    public String load(Long key) {
                        return "";
                    }
                });
    }
}

I get this error:

java.lang.NoClassDefFoundError: com/google/common/cache/CacheLoader
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.google.common.cache.CacheLoader
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" 

When downgrading the Gradle Wrapper version to 3.3 the problem is fixed but, I need version 3.5 for something else that is not feasible in version 3.3. As far as I can understand there is some dependency conflict between this version of Gradle and Guava but according to this post - it is not possible.

I know the jar is in place + using gradle dependencyInsight --dependency com.google.guava shows that the dependency exists:

:dependencyInsight
com.google.guava:guava:21.0
\--- compile

Thanks for any help

Hi, if anyone else encounters similar issues the answer is here.

A bug in my Intellij version caused compile scoped dependencies to transform into provided dependencies by Intellij. Upgrading the Intellij version solved the issue.