Gradle "cannot resolve symbol 'task'"

Hi,
I've just started working with Gradle - wrote the "hello world"

task helloWorld {

  println 'Hello World'

}

The symbols "task" and "helloWorld" are coming up cannot resolve.
+ when i try to create an new project or module, the "Gradle" option is not available as per http://www.jetbrains.com/idea/webhelp/creating-a-gradle-project.html

Some env. info:

  • IntelliJ IDEA ultimate 12.1.6
  • Windows O/S
  • Gradle 1.11
  • Groovy 1.8.6
  • I have the bundled Gradle  & Groovy plugins installed, and the Gradle is configured to the install folder
  • I can run the script from the IDE & command line


How do i get IJ to recognise the syntax?

~gilbert

7 comments
Comment actions Permalink

Hello Gilbert,

Could you check it with IDEA 13.1 EAP: http://confluence.jetbrains.com/display/IDEADEV/IDEA+13.1+EAP?
If the issue still occurs please provide idea.log (Help - Show Log in...).

0
Comment actions Permalink

Hi Yaroslav, I had IJ 13.0 installed, which has now expired (trial). I uninstall it and install 13.1 EAP, and it still won't start IJ - how can I get around this?

0
Comment actions Permalink

Hi Yaroslav,
I have upgraded to IDEA 13.1.1, so now all the Gradle project etc. options are there + most basic gradle keywords are resolved. I'm still unable to resolve stuff like:

scalaCompileOptions:
tasks.withType(ScalaCompile) {
 scalaCompileOptions.unchecked = true

ANT tasks:

 ant.move (todir: targetPath) {
 ant.fileset(dir: sourcePath) {

exec executable:

 exec {
 executable 'cmd'

any ideas?

0
Comment actions Permalink

Gilbert,

> scalaCompileOptions:

Have you installed Scala plugin?

> ANT tasks:

Do you have these actions in your ant build.xml?

> exec executable:

Seems it should work this way:

exec {
  executable = 'hostname'
}
0
Comment actions Permalink

Hi Yaroslav,

to answer your questions...

> scalaCompileOptions:

Have you installed Scala plugin?

yes, i have
     apply plugin: 'scala'

> ANT tasks:

Do you have these actions in your ant build.xml?

move, and fileset are standard ANT tasks/constructs, I'm not including an ANT build xml.

> exec executable:

Seems it should work this way:

exec {
  executable = 'hostname'
}

there is strange behaviour here...
When i change to executable = 'name' syntax in a single task, the IDE suddenly accepts the executable 'name' syntax in ALL other tasks - what gives? I'm fairly new to Groovy, and am concerned the two calls will have different results - "=" is a property assignment and no "=" is a method call...

To confirm, my Gradle build runs 100%, even though the IDE is reporting errors. I'm aiming for a clean IDE report.

Also, there are a few other errors reported, like:

task compileCoffee(dependsOn: processResources) {
     def sourcePath = "src/main/coffee"
     def targetPath = "${sourceSets.main.output.resourcesDir}/app"


     inputs.dir sourcePath
     outputs.dir targetPath
     ...

reports inputs and outputs to be unresolved symbols.

~gilbert

0
Comment actions Permalink

Gilbert,

Now, not all Gradle DSL elements are resolved in editor. We are adding them gradually.

0

Please sign in to leave a comment.