11

I am new to IJ IDEA and Gradle KTS.

I created the kts by hand and imported it into IJ. IDEA has generated the gradle wrapper, but I do not want this. If I delete the gradle wrapper and associated directory, IDEA prompts me to 'import changes' from gradle, which then creates the gradle wrapper again...

My question is how to prevent this behavior? ie prevent gradle wrapper generation?

I found documentation for the Wrapper task, and the option to point to a local install using distributionUrl. But that doesnt seem to prevent the generation of the gradle wrapper, only bypass the download...

Also I can not find any options in IDEA to disable this behavior.

btw I do understand the benefits of the wrapper.

Thanks.

IntelliJ IDEA EAP 2019.2 macOS 10.12.4 gradle 5.2.1 kotlin DSL 1.1.3

Peter
  • 398
  • 3
  • 20
  • Please try to set the Gradle location explicitly in Gradle project settings: https://i.imgur.com/heIff0F.png Does it help? – Andrey Jun 06 '19 at 06:49
  • Why don;t you want to use Gradle wrapper? Note that in that case you should have Gradle installed locally. – Andrey Jun 06 '19 at 07:07
  • The work-a-round works, thanks! There was a slight issue in that IDEA refused to resolve the symlink to local gradle, but the following link fixed that: https://stackoverflow.com/questions/18495474/how-to-define-gradles-home-in-idea If you want to add an Answer, I will accept it. – Peter Jun 07 '19 at 07:51
  • 2
    It's annoying you can't set this up before importing build.gradle.kts ... gradle wrapper is always generated on fresh import :-( – Torben Vesterager Aug 22 '19 at 12:56

1 Answers1

1

Disabling access to the download directory seems to work:

mkdir -p ~/.gradle/wrapper/dists && chmod -rwx ~/.gradle/wrapper/dists

Note that this prevents the wrapper to work at all (which is exactly what I want) and causes error messages, but as far as I can see it does the job and the project simply has to be configured to use the system gradle distribution after import.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83