How to add gradle generated sources to vsc launch.json - debugging

I'am trying to add gradle build folder to vsc debugger so I can run/debug my application outside the gradle plugin.
When I try to run it with de launch.json file because there are mapstruts generated maps generated inside the gradle build folder, vsc can't autowire them, so it fails.
With gradle plugin there are no problems.
I'm trying to add them with sourcePaths property like so:
"sourcePaths":[
"pathToGeneratedSources"
]

Related

IntelliJ Idea - How to enable gradle wrapper

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

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.

Run specific project using gradle

I have a Groovy application, I am using Gradle as my build tool. I have 2 seperate projects a Ratpack project with it's own build.gradle file and then a React project with it's own build.gradle file.
When I do ./gradlew run It builds my Ratpack project which in my Ratpacks build.gradle file has
compile project(':react-app')
In the dependencies closure.
Is there a way to just be able to run one of the projects for example ./gradlew runRatPack which stops the React project from being built?
If you can change the following line
compile project(':react-app') which states there is a Project Dependency to
compile name : 'react-app' - artifact dependency, then the project will try to pick the artifact from the repository instead of building the project.
Please let me know if the issue is addressed and this solves your issue.

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