intellij gradle based project unwanted output in bin/ dir - kotlin

I have a gradle based kotlin/java project using intellij IDEA for development.
As the project is gradle based all build artefacts are under gradles build/ directory|folder.
But there are also all .kt and .class files under <projectRoot>/bin
Does Intellij need to have these there?
I could not find anything in the project neither in intellij settings, nor did google searches enlighten me on this.
how to tell Intellij to work with the gradle build artefacts files under build/ and not to produce files under bin/ dir ???

I opened the project in eclipse now and then ... and Eclipse compiled to bin/.
So it wasn't Intellij at all ...
I apologise for the inconveniences

Related

Can't add build.sbt to .gitignore

I use IntelliJ and Scala plugin to build SBT projects. The thing is that me and my colleagues have a different version of SBT and Scala and I want to add build.sbt, build.properties and plugins.sbt in .gitignore so we can use the same project and work collaboratively on the code, but I don't want to commit/push my build.sbt file as we use different versions.
I tried to add *.sbt or build.sbt but it seems it won't get colored in yellow as other folders I have in .gitignore. Is it restricted to add these files in .gitignore?
It is complicated why we can't use the same versions of everything, we are behind a corporate network and downloading dependencies is a pain. Screenshot

gradle AbortException: FileNotFoundException when minifyEnable=true

I have an android project where we just upgraded to gradle wrapper 4.9-all and using gradle tools plugin com.android.tools.build:gradle:3.3.0-alpha04. I have different build variants. The build types using proguard and minifyEnabled=true are failing because they can't find the /libs folder:
Caused by: com.android.tools.r8.utils.AbortException: Error: /Users/username/projects/projectA/path-to-project/libs, java.io.FileNotFoundException:/Users/username/projects/projectA/path-to-project/libs (Is a directory)
at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:116)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:74)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:119)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:86)
at com.android.tools.r8.R8.run(R8.java:251)
at com.android.tools.r8.R8.run(R8.java:229)
at com.android.tools.r8.R8.lambda$run$0(R8.java:134)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:55)
If i set minifyEnabled=false, then the build completes successfully.
I have googled and haven't found anything specific to this issue. Is anyone else running into this?
[SOLVED] It was a proguard issue. In my proguard-rules.pro file, there was a setting of
-injars libs
The intent was to apply to all jars in the libs folder.
Well...somewhere between upgrading to gradle-wrapper 4.9
the behavior with proguard changed. Now I have to explicitly specify the
jar files.
-injars libs/a.jar
-injars libs/b.jar
-injars libs/c.jar
etc...

Gradle dist folder on IntelliJ classpath

We have a project which we build with gradle. We use IntelliJ as our development environment.
We have some resources we want to keep outside the JAR and so we have put them in the src/dist-folder. This works fine when running the application from the command line, but not so good when we want to debug from IntelliJ.
We could put a runtime-dependency to src/dist, but then we end up with files inside our lib-folder in the generated ZIP file and that's not what we would like to have.
Bottom line: how can we keep some resources outside the JAR (in src/dist) and also on the classpath of IntelliJ (as generated by Gradle; I don't want to have to add things manually to the IntelliJ classpath). The directory structure in the resulting zip should be something like:
root
|
|- config/*
|- css/*
|- lib/*
It seems that this question describes a similar problem, but the solution in addition #4 still mentions that no solution was found to correctly get the resources on the classpath of IntelliJ:
Gradle build file with conf folder with properties not in jar but on classpath
The solution I've used in a similar situation is to:
Use the Idea plugin in gradle rather than relying on the IntelliJ support.
Once that is working you can tweak the source path that IntelliJ uses in the gradle file itself

What option to select when cloning Git project in IntelliJ?

I have cloned Gradle project from GitHub in IntelliJ and then got the following dialog:
Should I select "existing sources" because my sources exist and not external, or should I select "external model" because it has Gradle specification?
You should choose Gradle becouse only this way the IDE will properly find and use build.gradle files.
You should choose external model. You want IntelliJ to look at your Gradle file and decide how to set itself up based on what is in your Gradle file.
You use the existing sources option when you don't have Gradle file or Maven pom and you need IntelliJ to look at the sources and figure out what to do without a file to guide it.
There is some documentation here: https://www.jetbrains.com/help/idea/2016.3/creating-a-project-by-importing-existing-sources.html

Intellij - build artifact

When I build a Jar in intellij (using "build artifacts...") it generates a jar that has invalid signature.
To solve it I always need to go inside the jar to META-INF folder and delete ORACLE_J.SF and ORACLE_J.RSA.
Any idea why it happens/how to solve it?