- Developing vert.x modules with Gradle
- Clone the template project
- Outputs
- Configuring the Project
- overriding default Vert.x configuration
- Other useful Gradle tasks
- Setup your IDE
- Changing the dependencies of your project
- Installing your module in Maven local
- Pushing your module to Maven
- Registering your module in the module Registry
- Next steps
Developing vert.x modules with Gradle
In this guide we'll show you how to develop a vert.x project using Gradle.
Clone the template project
We provide a template Gradle project which you can clone to get your started.
Clone it locally
git clone https://github.com/vert-x/vertx-gradle-template.git my-vertx-module
Where is the my-vertx-module
name of want to give your project.
Remove The origin
RM Origin
and add your new origin
Git remote add Origin <path to your repo>
Let's run the tests to make sure everything is working
CD my-vertx-module. /gradlew Test
You should use the Gradle Wrapper ( ./gradlew
) to run all Gradle tasks. You don't need to install Gradle manually. Take a look at for build.gradle
a list of the available tasks.
Outputs
The outputs of the project is:
- The Vert.x module zip file.
- A jar that corresponds to the module would also be produced. This was useful when you had another project which depends on the classes from your module, as it allows your to add it as A standard Gradle build dependency-your other project.
The outputs is created in the build
directory as per normal.
Configuring the Project
You configure many things in gradle.properties
:
modowner
, and determine the name of the module as described in the modname
version
modules manual
pullInDeps
Determines whether all module dependencies should is packaged into the module as nested modules.
It also contains various properties used to configure versions of various dependencies.
overriding default Vert.x configuration
If you want to override any Vert.x platform configuration, e.g. langs.properties
, cluster.xml
or logging configuration, can add those F Iles to the directory-these'll then is added to the src/main/platform_lib
vert.x platform Classpath When you run the module with./gradlew runMod
Other useful Gradle tasks
Open and take a look at the build.gradle
comments there for a list of useful tasks supported by the build script.
Setup your IDE
You can use the idea
and eclipse
Gradle plugins to create the project files for your IDE
./gradlew Idea
Or
./gradlew Eclipse
Once The IDE files has been created you can open the project files in your IDE.
Note:you can run the idea
or eclipse
tasks again if you change your project dependencies-in This is the IDE project fil Es'll be brought up-to-date.
Your IDE to use Java source compatibility level of Java 7, as Gradle seems to the default to Java 6 (!)
Changing the dependencies of your project
If your project needs a third party jar-to-build and you want-to-include it in the lib
directory of your module you can Add the dependency in the sections of with dependencies
build.gradle
a type of compile
.
If you don ' t want it's included in the directory of you lib
should add it as provided
.
Once you ' ve changed your dependencies just run ./gradlew idea
or ./gradlew eclipse
again to update your IDE project files with the new Dependen Cies.
Installing your module in Maven local
Use the ./gradlew install
install your module in your local Maven repository.
Pushing your module to Maven
Use as ./gradlew uploadArchives
normal-to-push your module to a Maven repository.
Registering your module in the module Registry
If you've pushed your module to a public Maven or Bintray repository you can register it in the module Registry so others Can search for and discover it.
Next steps
Now you've got the project all set-up and running, it's time to explore the standard project layout itself.
Excerpt from: Http://vertx.io/vertx2/gradle_dev.html#developing-vertx-modules-with-gradle
Developing Vert.x Modules with Gradle