Accessing Guava through CUBA dependencies

Hi
I learned that CUBA is using Guava so I’d like to use it also without adding another dependency, but I struggle to do so in IDEA.
For instance If I want to use EventBus IDEA finds the class in com.google.gwt.thirdparty.guava.common.eventbus located in vaadin-shared-7.6.7-cuba.1.jar, not sure this is the reightful one.
When I go to source code I’m redirected to the file com.google.common.eventbus.EventBus which is more what I was expecting.
When I launch gradle build I have the following error : package com.google.gwt.thirdparty.guava.common.eventbus does not exist.
I tried rebuild idea files and recreate build scripts with no chance.
Attached my build.gradle, tell me if you need more.
Michael

Seems attaching the file does not work (“fuild.gradle has incorrect file type”), copy pasted it below.

buildscript {
    ext.cubaVersion = '6.2.2'
    repositories {
        mavenLocal()
        maven {
            url 'https://repo.cuba-platform.com/content/groups/work'
            credentials {
                username(rootProject.hasProperty('repoUser') ? rootProject['repoUser'] : 'cuba')
                password(rootProject.hasProperty('repoPass') ? rootProject['repoPass'] : 'cuba123')
            }
        }

    }
    dependencies {
        classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"
    }
}

def globalModule = project(':app-global')
def coreModule = project(':app-core')
def guiModule = project(':app-gui')
def webModule = project(':app-web')

def servletApi = 'org.apache.tomcat:tomcat-servlet-api:8.0.26'


apply(plugin: 'idea')
apply(plugin: 'cuba')

cuba {
    artifact {
        group = 'com.busy.busyapp'
        version = '0.1'
        isSnapshot = true
    }
    tomcat {
        dir = "$project.rootDir/build/tomcat"
    }
    ide {
        copyright = '''Copyright (c) ${today.year} ${project.name}''' // Copyright Notice for IDEA project  
        classComment ='''/**
 * @author ${USER}
 */'''
        vcs = 'Git'
    }
}

def postgres = 'org.postgresql:postgresql:9.4-1201-jdbc41'

configure([globalModule, coreModule, guiModule, webModule]) {
    apply(plugin: 'java')
    apply(plugin: 'maven')
    apply(plugin: 'idea')
    apply(plugin: 'cuba')

    dependencies {
        testCompile('junit:junit:4.12')
    }

    task sourceJar(type: Jar) {
        from file('src')
        classifier = 'sources'
    }

    artifacts {
        archives sourceJar
    }
}

configure(globalModule) {
    dependencies {
        compile("com.haulmont.cuba:cuba-global:$cubaVersion")

    }

    task enhance(type: CubaEnhancing)

}

configure(coreModule) {

    configurations {
        jdbc
        dbscripts
    }

    dependencies {
        compile(globalModule)
        provided(servletApi)
        jdbc(postgres)
        testRuntime(postgres)
        compile("com.haulmont.cuba:cuba-core:$cubaVersion")
        testCompile("com.haulmont.cuba:cuba-core-tests:$cubaVersion")
        testCompile("com.haulmont.cuba:cuba-shared-lib:$cubaVersion")
        dbscripts("com.haulmont.cuba:cuba-core:$cubaVersion:db@zip")

    }

    task cleanConf(description: 'Cleans up conf directory') << {
        def dir = new File(cuba.tomcat.dir, '/conf/app-core')
        if (dir.isDirectory()) {
            ant.delete(includeemptydirs: true) {
                fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
            }
        }
    }

    task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
        appName = 'app-core'
        appJars('cuba-global', 'cuba-core', 
                'app-global', 'app-core')
    }

    task createDb(dependsOn: assembleDbScripts, description: 'Creates local database', type: CubaDbCreation) {
        dbms = 'postgres'
        dbmsVersion = 'null'
        host = 'localhost'
        dbName = 'busydev1'
        dbUser = 'busydba'
        dbPassword = 'admin'
    }

    task updateDb(dependsOn: assembleDbScripts, description: 'Updates local database', type: CubaDbUpdate) {
        dbms = 'postgres'
        dbmsVersion = 'null'
        host = 'localhost'
        dbName = 'busydev1'
        dbUser = 'busydba'
        dbPassword = 'admin'
    }
}

configure(guiModule) {
    dependencies {
        compile(globalModule)
        compile("com.haulmont.cuba:cuba-gui:$cubaVersion")
        testCompile("com.haulmont.cuba:cuba-client-tests:$cubaVersion")

    }

    task deployConf(type: Copy) {
        from file('src')
        include "com/busy/busyapp/**"
        into "$cuba.tomcat.dir/conf/app"
    }
}

configure(webModule) {
    configurations {
        webcontent

    }

    dependencies {
        provided(servletApi)
        compile(guiModule)
        compile("com.haulmont.cuba:cuba-web:$cubaVersion")
        webcontent("com.haulmont.cuba:cuba-web:$cubaVersion:web@zip")
        webcontent("com.haulmont.cuba:cuba-web-toolkit:$cubaVersion:web@zip")
        testCompile("com.haulmont.cuba:cuba-client-tests:$cubaVersion")

    }

    task webArchive(type: Zip) {
        from file('web')
        classifier = 'web'
    }

    artifacts {
        archives webArchive
    }

    task deployConf(type: Copy) {
        from file('src')
        include "com/busy/busyapp/**"
        into "$cuba.tomcat.dir/conf/app"
    }

    task clearMessagesCache(type: CubaClearMessagesCache) {
        appName = 'app'
    }
    deployConf.dependsOn clearMessagesCache

    task cleanConf(description: 'Cleans up conf directory') << {
        def dir = new File(cuba.tomcat.dir, '/conf/app')
        if (dir.isDirectory()) {
            ant.delete(includeemptydirs: true) {
                fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
            }
        }
    }

    task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
        appName = 'app'
        appJars('cuba-global', 'cuba-gui', 'cuba-client', 'cuba-rest-api', 'cuba-web', 
                'app-global', 'app-gui', 'app-web')
    }
}




task undeploy(type: Delete, dependsOn: ':app-web:cleanConf') {
    delete("$cuba.tomcat.dir/shared")
    delete("$cuba.tomcat.dir/webapps/app-core")
    delete("$cuba.tomcat.dir/webapps/app")
}

task restart(dependsOn: ['stop', ':app-core:deploy', ':app-web:deploy'], description: 'Redeploys applications and restarts local Tomcat') << {
    ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') {
        not {
            socket(server: 'localhost', port: '8787')
        }
    }
    start.execute()
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.13'
}

apply from: 'extra.gradle'

What did you import?
It should be


import com.google.common.eventbus.EventBus;

Indeed. For some reason my IDEA project was a mess and IDEA was completely lost, so I cleaned/regenerated it from Studio, now it’s ok.
BTW, when Studio generates IDEA project, it does not configure facets (Spring, JPA), is it intended ? It prevents using IDE features for beans and entities.
Of course it can be done manually but that would be nice from Studio to define the facets.
Michael

Spring and JPA support are the features of IDEA Ultimate, not everyone has it. So we just didn’t think about it yet.
You can try to customize the IDEA files generation in your build.gradle, see examples here https://docs.gradle.org/2.14/userguide/idea_plugin.html
and in our Gradle plugin:
https://github.com/cuba-platform/cuba-gradle-plugin/blob/master/src/main/groovy/CubaPlugin.groovy#L170
https://github.com/cuba-platform/cuba-gradle-plugin/blob/master/src/main/groovy/CubaPlugin.groovy#L427

Understood. Like I subbed for your fantastic platform, I was compelled to do the same for Jetbrains guys and their fantastic IDE :wink:
Keeping that information preciously, if over the course of time this situation gets frequent enough, I will likely follow this path.
Thanks Konstantin.
Michael