Gradle custom plugin as a standalone project - gradle

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.

Related

configure the gradle plugins configurations as a single custom gradle plugin

I am learning gradle. I am not able to understand the gradle docs since i am a beginner. can anyone guide me on how to replace the configurations of different gradle plugins in build.gradle files as single custom gradle plugin using extensions to configure

can you build a maven project inside of a gradle wrapper

It may be just that I have a general misunderstanding how gradle build works, but it feels to me that I can not build a maven file inside of a gradle build. Since gradle uses the gradle.build file, and maven uses a pom.xml, it does not seem as though I can do this. I have multiple maven projects that I would like to wrap up with a gradle wrapper. I can not find ANYTHING on whether this is even possible.
Both Maven and Gradle are build tools and you should only use one of them for a given project.
If you have existing Maven projects and like the functionality provided by the Gradle wrapper, there is a similar wrapper for Maven (note that this is currently a third-party plugin but they plan to include it in the upcoming release 3.7 of Maven).
Alternatively you could convert your projects entirely to Gradle.

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.

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