Background

Recently, I find that we need  to  type some very long gradle commands to run build, check, test, etc. It's very annoying, isn't it?

Idea

Can I write a script to run the gradle commands? Is that easy? If so, I only need to type 2 or 3 charactors(like "go" or "go 1") in this way. Considering we are working with windows 7, so I choose windows batch script to make my dream come true. ^_^

Solution

  Step 1: display a menu in the command line

 @echo off
::file name: go.bat
::##################Menu##################
:menuLoop
echo Task List
echo 1 Local build (clean build)
echo 2 Quick check (clean check -x :integrationTest ...)
echo 3 Intellij config (--refresh-dependencies cleanIdea idea)
set choice=
echo.&set /p choice=Choose one task or hit ENTER to quit: ||(goto :EOF)
echo.&call :task_%choice%
goto :EOF ::##################Tasks##################
:task_1
call gradle clean build
goto :EOF :task_2
call gradle clean check -x :integrationTest -x :coberturaIntegrationTest
goto :EOF :task_3
call gradle --refresh-dependencies cleanIdea idea
goto :EOF

  Step 2: accept one parameters

 ::#################Accept Parameters#################
::set option=%1
if "%1" == "" (
goto :menuLoop
) else (
goto :task_%1
)

  Put this part before the menu codes, then it should work.

OK, now I only need to type "go 2" if I want to do a quick check on my project codes.

NOTE: some tasks in the batch script above were written based on our project requirements. You need to make some changes about the commands.

Use windows batch script to create menu的更多相关文章

  1. Windows Batch 编程 和 Powershell 编程

    Batch Script - Functions with Return Values https://www.tutorialspoint.com/batch_script/batch_script ...

  2. 深入浅出Windows BATCH

    1.什么是Windows BATCH BATCH也就是批处理文件,有时简称为BAT,是Windows平台上的一种可运行脚本,与*nix(Linux和Unix)上的Shell脚本和其它的脚本(Perl, ...

  3. CCNET+ProGet+Windows Batch搭建全自动的内部包打包和推送及管理平台

    所要用的工具: 1.CCNET(用于检测SVN有改动提交时自动构建,并运行nuget的自动打包和推送批处理) 2.ProGet(目前见到最好用的nuget内部包管理平台) 3.Windows Batc ...

  4. Windows batch,echo到文件不成功,只打印出ECHO is on.

    jenkins 执行Windows batch command的时候,如果想要读写文件,echo到文件不成功. bat 代码如下: set ctime=%date%_%time% echo %ctim ...

  5. Use Windows Azure AD to create SSO projects

    Keywords Windows Azure AD, SSO Summary Use Windows Azure AD to create SSO projects Detailed Scenario ...

  6. windows batch语法

    windows BATCH基本知识扩展名是bat(在nt/2000/xp/2003下也可以是cmd)的文件就是批处理文件. ==== 注 =============================== ...

  7. [Windows Azure] How to Create and Deploy a Cloud Service?

    The Windows Azure Management Portal provides two ways for you to create and deploy a cloud service: ...

  8. jenkins 如何处理windows batch command

    这两天一直被一个问题困扰. 在jenkins的windows batch command 测试好的,拿到bat文件中,再从Execute Windows Batch command 中调用这个bat, ...

  9. Build step 'Execute Windows batch command' marked build as failure

    坑爹的Jenkis,在执行windows命令编译.NET项目的时候命令执行成功了,但是却还是报了这样一个错: Build step 'Execute Windows batch command' ma ...

随机推荐

  1. jquery.fullCalendar官方文档翻译(一款小巧好用的日程管理日历, 可集成Google Calendar)

    1. 使用方式, 引入相关js, css后, $(‘#div_name’).fullCalendar({//options});  接受的是一个option对象 2. 普通属性 2.1. year, ...

  2. 转:java中volatile关键字的含义

    转:java中volatile关键字的含义 在java线程并发处理中,有一个关键字volatile的使用目前存在很大的混淆,以为使用这个关键字,在进行多线程并发处理的时候就可以万事大吉. Java语言 ...

  3. JQ 选择器大全

    一.基本选择器 选择器 描 述 返回 示例 #id 根据给定id匹配一个元素 单个元素 $("#test") 选取id为test的元素 .class 根据给定类名匹配一个元素 集合 ...

  4. python之量的概念

    程序设计语言: 量的类型: 1. 直接量 2. 常量 3. 变量 量的因素: 1. 存储类别 2. 数据类型 3. 作用域 4. 生存期

  5. margin负值在页面布局中的应用

    http://www.w3school.com.cn/tiy/t.asp 预览工具 一.左右列固定,中间列自适应布局 此例适用于左右栏宽度固定,中间栏宽度自适应的布局.由于网页的主体部分一般在中间,很 ...

  6. Build Settings

    Add Open Scenes 选择一个关卡,使其处于打开状态,在菜单栏选择 File -> Build Settings 打开Build Settings窗口.选择 Add Open Scen ...

  7. Javascript实例:求数组中最大、最小值及下标

    题目:定义一个数组,并给出7个整数,求该数组中的最大值,及最大值下标,最小值及最小值下标.<script type="text/javascript">//定义一个数组 ...

  8. 【BZOJ 1188】 [HNOI2007]分裂游戏

    Description 聪聪和睿睿最近迷上了一款叫做分裂的游戏. 该游戏的规则试: 共有 n 个瓶子, 标号为 0,1,2.....n-1, 第 i 个瓶子中装有 p[i]颗巧克力豆,两个人轮流取豆子 ...

  9. Export Farm Solution wsp Files SharePoint 2007 and 2010

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")$farm = [Microsof ...

  10. eclipse的android智能提示设置

    eclipse的android智能提示设置 分类: android 技术2011-12-07 23:13 3069人阅读 评论(0) 收藏 举报 eclipseandroidtriggersjavaf ...