Jenkins is a visual automatic build script. Here, we use Jenkins to download the code with Git. Gradle packages and uploads dandelion, and finally sends the download link to the enterprise wechat.

Computer environment construction

  • JDK download and configure environment variables
  • SDK download and configure environment variables
  • GIT downloads and configures environment variables
  • Jenkins download and install.

First check the environment, command line input

java -version
adb start-server
git -version
Copy the code

If there are missing baidu add the corresponding environment variables. Gradle configuration details

Install Jenkins

1. We use BRW package manager to install Kenkins

First type the command line to execute

brew install jenkins

brew services start jenkins
Copy the code

Enter the address http://localhost:8080/ in your browser

2. Configure Jenkins’ global tool configuration

From home –>>> Department System Administration –>>> Global Tools configuration

In turn, the configuration

3. Configure the global ANDROID SDK path

Go to System Administration on the left and click system Settings as shown in the image below

The path needs to be changed to its own SDK path

4. Configure common plug-ins

Go to system Administration on the left, and click system Settings as shown in the picture below. The plug-ins that need to be installed are gradle and Git, which can be extended and downloaded according to your needs.

Configure package items

And then walk you through it step by step

1. Create a task name

2. Configure the code git repository

3. Configure Gradle to package APK

4. Compile and package APK

Check the output logs

4. Extension plug-ins

  • Git Parameter branch build plug-in
  • Jenkins uploads the Dandelion plugin
  • Jenkins nailing plugin
  • Jenkins enterprise wechat plug-in

Custom plug-in development

Next, a brief introduction to developing Jenkins plugins

1. Create

Install Maven first

brew install maven
mvn -version

Copy the code

Execute the gene autobuild scaffolding again

mvn archetype:generate -Dfilter=io.jenkins.archetypes:plugin

Copy the code

Input necessary information step by step, and import the generated code into IDEA

Plug-in development

First, the config. Jelly text box contains the parameter configuration information that needs to be passed in. The field is name, for example:

3. Write tasks to perform

extends Notifier implements SimpleBuildStep
Enterprise wechat AP sends messages
mvn clean


[plugin source](github.com/smileklvens… From: github.com/sonicrang/w…