Strinder
Strinder

Reputation: 2240

IntelliJ adds Import to Gradle at Copy Task

I have a very annoying and unexplainable behaviour in IntelliJ 2016.1:

If using Gradle copy task in a build file IntelliJ adds upon any edit in this file this import on top:

com.sun.org.apache.xalan.internal.xsltc.compiler.Copy

which is of course not necessary since this task is built-in Gradle. Upon execution this leads to this error:

Cannot create task of type 'Copy' as it does not implement the Task interface.

Copy Task is just a simple one like this:

task copyNodeModules(type: Copy) {
    group="_webapp"
    from('./src/main/ts/node_modules') {
        include '**/*'
        exclude '**/lite-server'
        exclude '**/json-server'
        exclude '**/.bin'
    }
    into project.buildDir.path + '/resources/someFolder'
}

Upvotes: 23

Views: 2794

Answers (2)

Hanbing Yin
Hanbing Yin

Reputation: 51

check your build.gradle see if it contains at the 1st line, just remove this line will fix the issue.

import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy

Upvotes: 2

Luke Quinane
Luke Quinane

Reputation: 16615

Going to Settings -> Auto Import -> Exclude from auto import and completion

and adding 'com.sun.org.apache.xalan.internal.xsltc.compiler' fixed this for me.

Upvotes: 18

Related Questions