在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):bmuschko/gradle-vagrant-plugin开源软件地址(OpenSource Url):https://github.com/bmuschko/gradle-vagrant-plugin开源编程语言(OpenSource Language):Groovy 100.0%开源软件介绍(OpenSource Introduction):Gradle Vagrant pluginGradle plugin for managing Vagrant boxes. UsageTo use the plugin, include in your build script: buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.bmuschko:gradle-vagrant-plugin:3.0.0'
}
} Base pluginIf you want to create your own task for managing Vagrant, you should go with the base plugin. This option is usually helpful
if you are dealing with multiple VMs in parallel. The base plugin provides all custom task types and preconfigures them with
sensible defaults. To use the base plugin, add the following apply plugin: 'com.bmuschko.vagrant-base' Custom task typesThe base plugin provides the following custom task types:
Extension propertiesThe base plugin defines the following extension properties in the
The recommended way for providing values to the
By default the plugin validates the installation of the Vagrant runtime and the selected provider. This validation logic
can be disabled from your buildscript. This is made possible through the nested configuration element
Exampleimport com.bmuschko.gradle.vagrant.tasks.VagrantUp
import com.bmuschko.gradle.vagrant.tasks.VagrantDestroy
ext {
virtualBoxDir = file('virtualbox-box')
fusionBoxDir = file('fusion-box')
fusionProvider = 'vmware_fusion'
}
task startVirtualBoxVm(type: VagrantUp) {
description = 'Starts VM machine running on VirtualBox.'
group = 'VirtualBox VM'
boxDir = virtualBoxDir
}
task stopVirtualBoxVm(type: VagrantDestroy) {
description = 'Stops VM machine running on VirtualBox.'
group = 'VirtualBox VM'
boxDir = virtualBoxDir
}
task startFusionVm(type: VagrantUp) {
description = 'Starts VM machine running on VMware Fusion.'
group = 'Fusion VM'
boxDir = fusionBoxDir
provider = fusionProvider
}
task stopFusionVm(type: VagrantDestroy) {
description = 'Stops VM machine running on VMware Fusion.'
group = 'Fusion VM'
boxDir = fusionBoxDir
provider = fusionProvider
} Convention pluginIf you want the plugin to preconfigure commonly-used tasks for you, you should go with the full-fledged convention plugin.
This plugin is a viable option if you only have to deal with a single VM. To use the convention plugin, add the following apply plugin: 'com.bmuschko.vagrant' Default tasksThe plugin defines the following tasks:
Examplevagrant {
boxDir = file('~/dev/my-vagrant-box')
environmentVariables {
variable 'IP', '192.168.1.33'
variable 'OPERATINGSYSTEM', 'redhat'
}
installation {
validate = false
}
}
import com.bmuschko.gradle.vagrant.tasks.Vagrant
import com.bmuschko.gradle.vagrant.tasks.VagrantSsh
task vagrantListsBoxes(type: Vagrant) {
description = 'Outputs a list of available Vagrant boxes.'
commands = ['box', 'list']
}
task vagrantEcho(type: VagrantSsh) {
description = 'Runs remote SSH command in Vagrant box.'
sshCommand = "echo 'hello'"
dependsOn vagrantUp
finalizedBy vagrantDestroy
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论