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. 【个人】IIS Express 配置

    <!-- 查看URL访问控制列表: netsh http show urlacl 添加URL访问控制: netsh http add urlacl url=http://myhostname:8 ...

  2. sail.js学习 - 一些问题

    问题: 一.数据填充: 在开发环境中,难免要填充一些基础数据用于测试用.现有两种方法 1.在bootstrap.js或者其他启动文件中创建一些数据 2.https://github.com/frost ...

  3. Android屏幕像素密度适配详解

    讲到像素密度,我们先要搞明白什么是像素密度,像素密度的字面上的意思为手机屏幕上一定尺寸区域内像素的个数.在Android开发中, 我们一般会使用每英寸像素密度(dpi)这样一个单位来表示手机屏幕的像素 ...

  4. MySQL 库大小、表大小、索引大小查询命令

    1.进去指定schema 数据库(存放了其他的数据库的信息)     mysql> use information_schema; 2.查询所有数据的大小      mysql> sele ...

  5. ApacheBench 使用教程

    ab压力测试 ab是Apache超文本传输协议(HTTP)的性能测试工具.其设计意图是描绘当前所安装的Apache的执行性能. 主要是显示你安装的Apache每秒可以处理多少个请求. 格式: ./ab ...

  6. tcp-client-c++

    #include "stdafx.h" #include <Winsock2.h> #include <iostream> #pragma comment( ...

  7. 从零开始学ios开发(七):Delegate,Action Sheet, Alert

    Action Sheet和Alert是2种特殊的控件(暂且称之为控件吧,其实不是控件真正的控件,而是ios中的2个类,这2个类定义了2种不同类型的用于和用户交互的弹出框),Action Sheet是从 ...

  8. ActiveMQ使用记录

    1.在Linux中安装ActiveMQ 官方文档地址:http://activemq.apache.org/getting-started.html#GettingStarted-StartingAc ...

  9. Windows Form 分页。

    其实功能实现很简单.我做的是一个通用的分页控件.项目时间很紧,可能有点粗糙.欢迎大家斧正.不说了直接贴代码吧. using System; using System.Collections.Gener ...

  10. Animations--动画基础

    基础动画 //1.在0.5s内,将_field.alpha 的数值变为1.0 [UIView animateWithDuration:0.5 animations:^{ _field.alpha = ...