Gradle Imports Are Not Recognised

The static import in the gradle script below is marked as red.
Is this a known bug?

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath group: 'org.codehaus.gpars', name: 'gpars', version: '1.2.1'
    
}
}

8 comments
Comment actions Permalink

Can't reproduce. With the example you have provided the import would be marked as Unused.

If you add a usage in the build file, it resolves just fine here and navigation to GParsPool works from the editor.

Please try File | Invalidate Caches | Invalidate and Restart.

1
Comment actions Permalink

I have a gradle file where I use Ant Os, and extend Exec, however intellij only seems to resolve the Pattern import.
unresolved imports.png
Surely there must be something I'm doing wrong, since the script compile and runs fine from gradle? How do I instruct Intellij to resolve these imports, so I can get code completion in my gradle scripts ?

0
Comment actions Permalink

Try to refresh the project in Gradle Tool window, if it does not solve the problem, could you attach *.iml files and ".idea" folder, please?

0
Comment actions Permalink

Thanks for the response Vladislav, I have created a new (simple) project that shows this.

I'm using Mac, Intellij 14.



Attachment(s):
gradleTest.zip
0
Comment actions Permalink

Open File | Settings | Build, Execution, Deployment | Build Tools | Gradle page and try select "Use default gradle wrapper" option, does it help?

0
Comment actions Permalink

Using the default wrapper solves this issue, but that would mean that I can't control the gralde version.
Also one of the main features in gradle, is that the build script describes which version of gradle should be used, and if you check in gradlew, you only need JAVA (JAVA_HOME) on you CI server to bootstrap the build process. On maven it was a big issue that individual developers had different mvn version, which lead to all kind of problems - "but It works on my PC!"

0
Comment actions Permalink

you can control the gradle version using \<project_path>\gradle\wrapper\gradle-wrapper.properties file using distributionUrl property

0
Comment actions Permalink

I think the problem was, that I expected to run gradle using the same wrapper from intelliJ and on the command line. On the CI-server we need the wrapper.jar, but it looks like we can just use the default wrapper provided by intellij when running inside the IDE.

Thanks for the help :)

0

Please sign in to leave a comment.