After mvn clean:clean , IntelliJ Idea 2019 , regenerates target folders on its own
Answered
When I run mvn `clean:clean` from IntelliJ terminal , at first the target folders get deleted from my project but within seconds they reappear .
If I close the project from IntelliJ and then run the `mvn clean:clean` from my OS terminal , then the target folders don't get regenerated.
This proves that Intellij is behind this. How to disable this ? Why does IntelliJ do it ?
Please sign in to leave a comment.
IDE creates target folder on Build action or sometimes during import from Maven process when there are some code generators configured in Maven. After what action do you see them appearing? E.g. do you have auto-make enabled (when IDE will compile project after you change source code) or Maven Auto-import (when IDE re-imports Maven project after pom.xml files change)? Any 3rd plugins you use?
I have enabled Maven Auto-import (when IDE re-imports Maven project after pom.xml files change)
but even if I don't make any changes to POM , and I just run clean:clean , target folders get auto generated ?
How is this related to target folders regeneration ? How to disable regeneration of target folders ?
Here is a screenshot of configurations :
Then it is not the Maven import. Does it happen even if you do not change the focus from terminal? Can you show a short screencast of the behaviour? Please also provide idea.log after IDE restart. For uploading you can use ftp://ftp.intellij.net/.uploads / https://uploads.services.jetbrains.com or any file sharing service.
This action may also create the target folder:
Okay , got it. This option was enabled in settings : Preferences -> compiler -> Build project automatically
One question though : Why would anybody want to enable this option ? ( Though I had also done but accidently !! )
This could be useful to always have code compiled up to date and see a compilation errors if any.