• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

marc0der/gradle-spawn-plugin: Gradle plugin for spawning and killing command lin ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

marc0der/gradle-spawn-plugin

开源软件地址(OpenSource Url):

https://github.com/marc0der/gradle-spawn-plugin

开源编程语言(OpenSource Language):

Groovy 98.5%

开源软件介绍(OpenSource Introduction):

Gradle Spawn Plugin

This plugin is used for starting and stopping UNIX command line processes from within your build.

A typical application of this plugin is for stopping and starting an embedded web server when running functional tests from within your build.

Setup

Add the following to your build.gradle:

import com.wiredforcode.gradle.spawn.*

buildscript {
	repositories {
		...
		maven { url 'http://dl.bintray.com/vermeulen-mp/gradle-plugins' }
	}
	dependencies {
		classpath 'com.wiredforcode:gradle-spawn-plugin:0.8.0'
	}
}

apply plugin: 'com.wiredforcode.spawn'

task startServer(type: SpawnProcessTask, dependsOn: 'assemble') {
	command "java -jar ${projectDir}/build/libs/zim-service.jar"
	ready 'Started Application'
}

task stopServer(type: KillProcessTask)

The startServer task is used for starting the process.

The command line passed into the command method is typically a blocking process. The String passed into the ready method is the trigger used for continuing the build once the server process is up and running. If this String is discovered in the stdout stream of the server, the process will be placed into the background and the Gradle build will continue.

Once the build draws to a close, the stopServer task is then used to gracefully shut down the server process.

PID File

The SpawnProcessTask will automatically deposit a .pid.lock file in the working directory. This contains the PID of the running process. The KillProcessTask will read this lock file, kill the process gracefully, and remove the file.

It is also possible to set the name of the pid file allowing more than one process to be opened.

task startServer(type: SpawnProcessTask, dependsOn: 'assemble') {
	command "java -jar ${projectDir}/build/libs/zim-service.jar"
	ready 'Started Application'
	pidLockFileName '.other.pid.lock'
}



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap