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.
Related
I'm trying to convert a project from maven to gradle, but I'm having trouble getting hot reloading to work the same way. I can't show the actual project so I've created two identical very simple projects. One with maven one with gradle. These projects contain two modules:
project
|____api
|____lib
The /api module contains a spring-boot app which depends on code from the /lib module
In the maven project I can change code in either of these modules and recompile either with my IDE (intellij) or with the maven cli and spring-boot-devtools will hot reload the application. However in the gradle version it only successfully hot reloads code that has changed in the /api module.
From what I gathered this seems like a classpath issue. If you run gradle or maven in debug mode it prints out the classpath it passes when it starts the application. Maven includes <project_dir>/lib/target/classes/kotlin/main. However gradle only includes <project_dir>/lib/build/libs/lib.jar
I'm very new to gradle to I might have some of the build configuration messed up. Here are the two project repo's:
Maven: https://github.com/Perry-Olsson/mvn-hot-reload
Gradle: https://github.com/Perry-Olsson/gradle-hot-reload
I have custom gradle plugin as a standalone project. I would like to use it in other project.
Suppose that plugin is not yet build. Is there any way how can I compile my plugin (in my other project) and add it on classpath to buildScript block all in one build.gradle of my other project ?
I am new to gradle so sorry if this is dumb question.
Use Intellij 2017.2.2 IDE. I have multiple maven module in a project. If i add a method in module1, to see the method in module2. I firstly have to build module1, then i will be able to see new added method in module2. Is there a option in intellij for this?
I created a gradle project having common code among all the projects in the same workspace. For this,
I set this new project in class path of all other projects. So it is available at compilation time.
I mentioned package structure of new project in application-context (spring configuration) of all projects. So that the component of new project can be autowired.
In build.gradle of every project, I have addedn an extra entry under dependencies task i.e. compile project(':newproject')
Everything is running fine. Only I need to figure out gradle task to generate jar of new project.
Is it the correct way? Or should I
build jar of new project,
define it as dependency in build.gradle of other projects,
copy it libs folder of other project at the time of deployment.
In 2nd approach, I have no idea how Spring'll autowire the bean of newproject.
Adding the dependencies manual via a build jar file would be strange. I would stay with the "correct" dependencies and try to figure out a way to build the jar of "new project".
I have a multi module maven project (a war) on of these modules utilized executes a post-compile step to update JiBX bindings.
I would like to use IntelliJ to build and deploy this project. However I can't seem to figure out how to get IntelliJ to kick off the JiBX compiler. Any thoughts?
If it isn't possible to kick off the JiBX compiler, I'd like IntelliJ to treat the module that requires the JiBX compilation step as a "normal" dependency and simply pull the appropriate jar from my local maven repository.
If you don't have this already... in your IntelliJ run/debug configuration check the "Run Maven Goal" checkbox and choose jibx:bind from the jibx entry under plugins.