IntelliJ Idea - How to enable gradle wrapper - gradle

Importing gradle project into intelliJ IDEA : use default gradle wrapper option (not configured for the current project) is disabled.
How to solve this?

So you ask why this option is grayed out?
That because the your project doesn`t have a wrapper.
You can add a wrapper by using the task
gradle wrapper
This will add a gradle directory , a file named gradlew.bat and one named gradlew
after this you can reimport your project or
change it in your settings control + shift + s

Related

Gradle : buildSrc not reconized as a source folder. (How to configure in IntelliJ and/or Eclipse) ? (CustomTask)

I need de create CustomTask in my gradle project.
However the buildSrc directory is not reconized as a source code folder so I cannot debug and test easaly.
What is the way to do it ? (on IntelliJ and/or Eclipse) ?
You can see an example project here : https://github.com/marcelkobaingithub/stack-overflow-gradle-buildsrc
Ok on intelliJ simply add gradle java plugin ... :)

How do I add a module dependency in gradle.build

I use Intellij Idea. I have a java gradle project with two modules ('main' and 'repo'). I add a dependency in the main module to the repo module, using the "Project Structure" menu. My project builds ok, but when I run a sonarqube task in my project, the module depencency has gone. Is there a way to add a dependency to a module in gradle, so it doesn't disappear?
If you configure your project only in IntelliJ your gradle configuration will not be change because it is an IntelliJ configuration only.
The "normal" way is: first you set your gradle configuration and then just open your project in IntelliJ. Everything will work automagically inside InTelliJ.
Here is the documentation explaining how to add a sub project in gradle.

What exactly happens when you hit the IntelliJ "run" button? [duplicate]

IntelliJ IDEA 2016.3 add the ability to delegate build/run to Gradle.
It's clear that when the delegate option is on Gradle is doing everything.
My question is what exactly IntelliJ is doing when this option is off?
I'm asking this because I have custom code inside my Gradle files and it does not seems like this code is executed when building in IntelliJ. When I run gradlew build everything works just fine.
IntelliJ has its own build system, called JPS, which uses the IntelliJ IDEA project and .iml files as the project model. When you're using IntelliJ IDEA's default build system to build the project, it does not execute any code in Maven or Gradle files; it uses its own logic, which can only be extended by writing plugins to JPS.

IntelliJ run configurations for Netbeans RCP project

there's a project I'm working on with a team (BUMMEL) and we've migrated it's build tool from Ant to Maven, to make it IDE-agnostic, and now I can open it into IntelliJ as a Maven project but I have troubles creating the run configuration for it.
Can anyone suggest me how to create a Run configuration? Also any other suggestions about running NetBeans-RCP maven-based project on IntelliJ are appreciated.
It looks like you should go to Edit Configurations... and add new Maven configuration.
Then put in Working directory: field a path you your app module, for me its application/ in the project root.
And in Command line: field put nbm:cluster-app nbm:run-platform.
Now you can run your app by selecting a newly created configuration and pressing a green "Play" arrow.

Compiling with gradle idea

Hi) when I compile the project are with gradle idea, I should get jar file...?
maybe in the folder dist...
The problem is that I get only two files start.sh and start.cmd
gradle idea doesn't compile the project. It creates project files (*.iws, *.ipr, *l.iml) for IDEA (the IDE from JetBrains). Likewise, there is gradle eclipse to create project files for the Eclipse IDE.
To create a Jar, you can do gradle jar or gradle build (assuming you have the java plugin applied). gradle tasks shows which tasks are available for a given project.
start.sh and start.cmd sound like they are coming from the application plugin. Are you using the application plugin?
The above poster is right that gradle idea simply creates the IntelliJ files that define your modules, src locations, etc. It does NOT compile the project.
Adding apply plugin: 'java' to your build.gradle will allow you to run gradle jar to generate a jar file.

Resources