Developing Vert.x Modules with Gradle

  • 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 you started.

Clone it locally

git clone https://github.com/vert-x/vertx-gradle-template.git my-vertx-module

Where my-vertx-module is the name you want to give your project.

Remove the origin

git remote 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 do not need to install Gradle manually. Take a look atbuild.gradle for a list of the available tasks.

Outputs

The outputs of the project are:

  • The Vert.x module zip file.
  • A jar that corresponds to the module will also be produced. This is useful when you have another project which depends on the classes from your module, as it allows you to add it as a standard Gradle build dependency in your other project.

The outputs are created in the build directory as per normal.

Configuring the project

You configure many things in gradle.properties:

  • modownermodname and version determine the name of the module as described in the modules manual
  • pullInDeps determines whether all module dependencies should be 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.propertiescluster.xml or logging configuration, you can add those files to the directory src/main/platform_lib - these will then be added to the Vert.x platform classpath when you run the module with ./gradlew runMod

Other useful Gradle tasks

Open build.gradle and take a look at the 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 have 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 way the IDE project files will be brought up-to-date.

You may have to tell your IDE to use Java source compatibility level of Java 7, as Gradle seems to 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 dependencies section of build.gradle with a type of compile.

If you don‘t want it to be included in the lib directory you 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 dependencies.

Installing your module in Maven local

Use ./gradlew install to install your module in your local Maven repository.

Pushing your module to Maven

Use ./gradlew uploadArchives as 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.

摘自:http://vertx.io/vertx2/gradle_dev.html#developing-vertx-modules-with-gradle

时间: 2024-10-10 04:17:31

Developing Vert.x Modules with Gradle的相关文章

Ansible configure management--翻译(二)

一. Getting Started with Ansible Ansible is profoundly different from other configuration management tools available today. It has been designed to make configuration easy in almost every way, from its simple English configuration syntax to its ease o

Python:渗透测试开源项目

Python:渗透测试开源项目[源码值得精读] sql注入工具:sqlmap DNS安全监测:DNSRecon 暴力破解测试工具:patator XSS漏洞利用工具:XSSer Web服务器压力测试工具:HULK SSL安全扫描器:SSLyze 网络 Scapy: send, sniff and dissect and forge network packets. Usable interactively or as a library pypcap, Pcapy and pylibpcap:

Python:渗透测试开源项目【源码值得精读】

sql注入工具:sqlmap DNS安全监测:DNSRecon 暴力破解测试工具:patator XSS漏洞利用工具:XSSer Web服务器压力测试工具:HULK SSL安全扫描器:SSLyze 网络 Scapy: send, sniff and dissect and forge network packets. Usable interactively or as a library pypcap, Pcapy and pylibpcap: several different Python

AndroidStudio使用教程(第四弹)

AndroidStudio使用教程(第四弹) Gradle 讲解到这里我感觉有必要说明一下Gradle. Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化建构工具.它使用一种基于Groovy的特定领域语言来声明项目设置,而不是传统的XML. 更多介绍请直接参考Gradle或Google搜索. 以下是为什么Android Studio选择Gradle的主要原因: - 使用领域专用语言(Domain Specific Language)来描述和处理构建逻辑.(以下

android studio学习----gradle基础

Gradle是一种依赖管理工具,基于Groovy语言,面向Java应用为主,它抛弃了基于XML的各种繁琐配置,取而代之的是一种基于Groovy的内部领域特定(DSL)语言. 安装Gradle 在Android Studio系列教程一--下载与安装中新建项目成功后会下载Gradle,貌似这个过程不FQ也是可以下载,但是访问特别慢,建议FQ下载.那么下载的Gradle到什么地方呢? Mac上会默认下载到 /Users/<用户名>/.gradle/wrapper/dists 目录 Win平台会默认下

Gradle详解

Gradle是可以用于Android开发的新一代的 Build System, 也是 Android Studio默认的build工具. Gradle脚本是基于一种JVM语言 -- Groovy,再加上DSL(领域特定语言)组成的. 因为Groovy是JVM语言,所以可以使用大部分的Java语言库.所谓DSL就是专门针对Android开发的插件,比如标准Gradle之外的一些新的方法(Method).闭包(Closure)等. 由于Gradle的语法足够简洁,而且可以使用大部分的java包,当之

解决Android Studio卡在Gradle:Resolve dependecies &#39;app:_debugCompile&#39;问题

转载: http://blog.csdn.net/callzjy/article/details/53662073 关键代码 maven { url 'http://maven.oschina.net/content/groups/public/' } 完整代码 // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repo

Maven和Gradle

Maven和Gradle对比 Java世界中主要有三大构建工具:Ant.Maven和Gradle.经过几年的发展,Ant几乎销声匿迹.Maven也日薄西山,而Gradle的发展则如日中天.笔者有幸见证了Maven的没落和Gradle的兴起.Maven的主要功能主要分为5点,分别是依赖管理系统.多模块构建.一致的项目结构.一致的构建模型和插件机制.我们可以从这五个方面来分析一下Gradle比起Maven的先进之处. 依赖管理系统 Maven为Java世界引入了一个新的依赖管理系统.在Java世界中

【转】Android Studio安装配置学习教程指南 Gradle基础--不错

原文网址:http://www.linuxidc.com/Linux/2015-02/113890p4.htm 其实很早之前也写了一篇Gradle的基础博客,但是时间很久了,现在Gradle已经更新了很多,所以暂且结合Stduio 1.0正式版与最新的Gradle语法来详细讲解下,小伙伴们直接跟我一步步来学习吧. 什么是Gradle? Gradle是一种依赖管理工具,基于Groovy语言,面向Java应用为主,它抛弃了基于XML的各种繁琐配置,取而代之的是一种基于Groovy的内部领域特定(DS