Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ adds Import to Gradle at Copy Task

Tags:

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' } 
like image 348
Strinder Avatar asked May 20 '16 13:05

Strinder


People also ask

How do I sync Gradle project in IntelliJ?

If you have some custom plugins that require you to import your project from the IntelliJ IDEA model, press Ctrl+Shift+A and search for the Project from Existing Sources action. In the dialog that opens, select a directory containing a Gradle project and click OK. IntelliJ IDEA opens and syncs the project in the IDE.


2 Answers

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.

like image 137
Luke Quinane Avatar answered Oct 28 '22 08:10

Luke Quinane


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 
like image 25
Hanbing Yin Avatar answered Oct 28 '22 08:10

Hanbing Yin