If you configure a dependency in Gradle without specifying a version, the build fails with an error saying the dependency cannot be found.
But when you have a lot of dependencies, you also have to trawl the repository one by one to see what the latest version of each library is.
So does Gradle support using the latest version of a dependency directly?
The answer is yes, though gradle’s documentation doesn’t flag it in any prominent place.
The trick is to put a plus sign + in the version field, and gradle will work out the latest version automatically and download it.
Once everything is pointed at the latest version, you can then work through the few remaining dependency-conflict errors from the log, which saves a great deal of effort.
Read more
Gradle is a very flexible and powerful build system, but its concepts are relatively complex. As long as you grasp the core and keep the distinctions straight, it will not feel confusing.
Does the build script below look hard to understand?
buildscript {
repository for build script dependencies
repositories {
mavenCentral()
}
// build script dependencies
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
}
}
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
implementation 'com.google.guava:guava:30.1-jre'
testImplementation 'junit:junit:4.13.2'
}
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.jvm' version '1.5.10'
}
In the field of software development and continuous integration/delivery, Jenkins is a very popular tool for automating build, test and deployment processes. A Jenkins pipeline is a powerful mechanism that can automate the entire software delivery process by defining a series of stages, steps and conditions. However, when describing the process of creating a pipeline, which word should we use to describe it: setting up, configuring, or developing?
Read moreIntroduction to Jenkins
Jenkins is a popular open-source continuous integration and delivery tool. It provides an extensible plugin ecosystem and can be used to automate the building, testing and deployment of software projects.
Jenkins releases
Jenkins releases fall into the following types:
- LTS release: a Long-Term Support (LTS) release, published once every 12 weeks. These releases are extensively tested and validated and come with long-term support, and they are usually used in production environments. The LTS release cycle is relatively long, so LTS releases are comparatively stable and reliable.
Question 36: What is the relationship between Hudson and Jenkins?
Answer: Both are open-source continuous integration tools written in Java.
In fact, Jenkins is a fork of Hudson.
Read moreOnce Jenkinsclient is configured, you can operate Jenkins through commands.
The command format of jenkinsclient is:
jenkins GROUP | COMMAND
GROUP refers to a group of commands. For example, job is a group command, and it provides the following commands:
jenkins job build //build a job
jenkins job copy //copy a job
jenkins job create //create a job
jenkins job delete //delete a job
jenkins job disable //disable a job
jenkins job enable //enable a job
jenkins job has //check whether a job already exists
jenkins job info //show job information
jenkins job ls //show the job list
jenkins job rename //rename a job
jenkins job xml //show the contents of a job's config.xml
Today we’ll skip group commands for now and start with the top-level COMMANDs. These commands are mostly used to view various kinds of information.
1. Easter Egg — APP Mode
APP mode lets you operate Jenkins in a standalone window. It feels just like using an app.
Command:
jenkins app
Video demo:
Read moreIntroduction to jenkinsclient
Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client. It provides a Docker-style command line for users to operate Jenkins.
Jenkinsclient is written in Python, and the project source code is open-sourced under China’s Mulan Open Source License. You can view it on Gitee and Github.
Gitee: https://gitee.com/hummerstudio/jenkinsclient
Github: https://github.com/hummerstudio/jenkinsclient
Project homepage: https://pypi.org/project/jenkinsclient
Read moreBackground
Starting a process through Jenkins is a fairly common scenario in real-world work.
But under normal circumstances, a process started by a Jenkins job is killed by Jenkins once the build finishes.
Read moreAutomation is a revolutionary concept and technology.
First-Generation Automation
The first generation of automation is the automation of the heaven-and-earth system: the growth of all things.
Heaven supplies energy as yang, earth takes form as yin; the ancient sages observed this and put it to use. Following the four seasons and adapting to local conditions is what is called wu wei (non-action). Wu wei is not inaction — it is acting in accordance with nature.
The automation of this generation has three elements: heaven, earth and man.
Weather reflects the intensity and total amount of the solar energy supplied. The changes of weather divide broadly into the four seasons and finely into the twenty-four solar terms. Terrain differs from place to place, so one adapts to local conditions; and people must sow, water, fertilize and feed at the right time and in the right place, as if playing in concert with heaven and earth — hence human harmony.
Although heaven and earth are already automated, from the human point of view it still takes the right action at the right moment for all things to grow as humans intend.
Read moreIntroducing Jenkinsclient
Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client that supports multiple instances. The project is open-sourced under the Mulan open source license.
Version 1.0 was officially released a few days ago.
PyPI project page: https://pypi.org/project/jenkinsclient/
Read moreThe Jenkins Plugin Center domestic mirror
The 1500+ plugins Jenkins offers are its most valuable resource and its defining feature; they give Jenkins powerful functionality, flexibility, and the ability to connect and interact with other platforms.
Recently, however, users in China have clearly felt that Jenkins downloads plugins very slowly, and that downloads often time out and fail. This problem has caused a great deal of trouble for users in China.
This is mainly because the network infrastructure servers of the Jenkins open source community are all located abroad.
In November 2019, the Jenkins Chinese community released a domestic mirror address.
This mirror solved the problem that other mirrors had always had — that they could not really be used — so that users in China can now download plugins at the full speed their bandwidth allows.
Read moreSymptom
In the Docker Preferences options, “Enabel Kubernetes” is selected to enable Kubernetes, but it stays in the starting state and cannot be used normally.
Cause
To enable the Kubernetes feature, Docker needs to pull the Kubernetes-related images from an image registry.
Because access to Docker Hub is too slow from within China, the images cannot be pulled successfully, which leaves Kubernetes stuck in the starting state.
Jenkins gives you two ways to develop your pipeline code: scripted and declarative.
The scripted pipeline (also known as the “traditional” pipeline) is based on Groovy as its domain-specific language. The declarative pipeline, on the other hand, offers a simplified and friendlier syntax, with dedicated statements for defining it and no need to learn Groovy.
Version 2.5 of the Jenkins Pipeline plugin introduced support for the declarative pipeline.
In this article, we will go over all the available directives for developing declarative pipeline scripts, which will make its capabilities clear.
Read moreGroovy syntax overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it has been enhanced with specific types and permits certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax derives from Java syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax derives from Java syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreOverview
These are all concepts from the Ruby language. Below I introduce the meaning of each term and compare it with similar tools, so that readers can understand them.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it is enhanced with specific types and allows certain simplifications.
Read more- Question 31: I have several nodes with the same environment and want jobs to be automatically assigned to idle nodes. Is that possible?
- Question 32: How does Jenkins work with the various static analysis tools?
Question 31: I have several nodes with the same environment and want jobs to be automatically assigned to idle nodes. Is that possible?
Reference: You only need to configure the same label on these nodes that share the same environment, and have the job specify that label as its run node; Jenkins will then automatically pick an idle node to execute the job. A label in Jenkins carries the sense of a category or group, just like the label feature in WeChat’s contacts. It is simply not designed very conspicuously, so if you don’t know about it, it’s easy to mistake it for a unique ID.
Question 32: How does Jenkins work with the various static analysis tools?
Read moreJenkins: nothing of its own, yet capable of everything
Jenkins is, in essence, an automation server.
Create a job on Jenkins and configure it, and that job will execute automatically in whatever way you want. Archimedes once said, “Give me a fulcrum and I will move the whole earth.” Wozijishuode also said, “Give me a Jenkins and I can automate everything.”
Read more- Question 16: Can a timeout be set with Pipeline code?
- Question 17: Is there a plugin that can monitor changes to the Jenkins configuration?
Question 16: Can a timeout be set with Pipeline code?
Reference: Yes. The following code sets a timeout of 1 hour, and it can be set either globally for the pipeline or at the stage level:
options {
timeout(time: 1, unit: 'HOURS')
}
Question 17: Is there a plugin that can monitor changes to the Jenkins configuration?
Read more- Question 11: How do I trigger other Jenkins jobs from a Pipeline script?
- Question 12: Is there a convenient way to see the list of currently installed plugins and their versions on Jenkins? You can see them under Manage Plugins - Installed, but copying them out brings extra information that is hard to handle. For example, the extra plugin descriptions mean that after pasting into a spreadsheet you still have to delete them one by one manually.
Question 11: How do I trigger other Jenkins jobs from a Pipeline script?
Answer: There is a build step you can look into; it supports both synchronous and asynchronous triggering.
Question 12: Is there a convenient way to see the list of currently installed plugins and their versions on Jenkins? You can see them under Manage Plugins - Installed, but copying them out brings extra information that is hard to handle. For example, the extra plugin descriptions mean that after pasting into a spreadsheet you still have to delete them one by one manually.
Read moreQuestion 6: What is the relationship between Blue Ocean and Jenkins?
Answer: Put simply, Blue Ocean can be seen as a new UI that Jenkins introduced, with a more modern look and better interaction.
Of course, the most important thing is its support for the new pipeline job type introduced in Jenkins 2.x, which can clearly show the serial/parallel relationships and statuses of the various stages in the whole Pipeline.
Read more- Question 1: How do Jenkins and Docker work together?
- Question 2: When writing a pipeline with two stages, the first of which is assigned to a random machine to run on, and the second of which has to run on the same machine as the first, is there any way to do that?
Question 1: How do Jenkins and Docker work together?
Reference: You can combine Jenkins with Docker by using containers as Jenkins agent nodes, which has many advantages. For example, it unifies the execution environment, creates and destroys agents automatically, and removes the cost of maintaining environments by hand.
Question 2: When writing a pipeline with two stages, the first of which is assigned to a random machine to run on, and the second of which has to run on the same machine as the first, is there any way to do that?
Read more
In the field of software development and continuous integration/delivery, Jenkins is a very popular tool for automating build, test and deployment processes. A Jenkins pipeline is a powerful mechanism that can automate the entire software delivery process by defining a series of stages, steps and conditions. However, when describing the process of creating a pipeline, which word should we use to describe it: setting up, configuring, or developing?
Read moreIntroduction to Jenkins
Jenkins is a popular open-source continuous integration and delivery tool. It provides an extensible plugin ecosystem and can be used to automate the building, testing and deployment of software projects.
Jenkins releases
Jenkins releases fall into the following types:
- LTS release: a Long-Term Support (LTS) release, published once every 12 weeks. These releases are extensively tested and validated and come with long-term support, and they are usually used in production environments. The LTS release cycle is relatively long, so LTS releases are comparatively stable and reliable.
Question 36: What is the relationship between Hudson and Jenkins?
Answer: Both are open-source continuous integration tools written in Java.
In fact, Jenkins is a fork of Hudson.
Read moreIntroducing Jenkinsclient
Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client that supports multiple instances. The project is open-sourced under the Mulan open source license.
Version 1.0 was officially released a few days ago.
PyPI project page: https://pypi.org/project/jenkinsclient/
Read moreThe Jenkins Plugin Center domestic mirror
The 1500+ plugins Jenkins offers are its most valuable resource and its defining feature; they give Jenkins powerful functionality, flexibility, and the ability to connect and interact with other platforms.
Recently, however, users in China have clearly felt that Jenkins downloads plugins very slowly, and that downloads often time out and fail. This problem has caused a great deal of trouble for users in China.
This is mainly because the network infrastructure servers of the Jenkins open source community are all located abroad.
In November 2019, the Jenkins Chinese community released a domestic mirror address.
This mirror solved the problem that other mirrors had always had — that they could not really be used — so that users in China can now download plugins at the full speed their bandwidth allows.
Read moreSymptom
In the Docker Preferences options, “Enabel Kubernetes” is selected to enable Kubernetes, but it stays in the starting state and cannot be used normally.
Cause
To enable the Kubernetes feature, Docker needs to pull the Kubernetes-related images from an image registry.
Because access to Docker Hub is too slow from within China, the images cannot be pulled successfully, which leaves Kubernetes stuck in the starting state.
- Question 31: I have several nodes with the same environment and want jobs to be automatically assigned to idle nodes. Is that possible?
- Question 32: How does Jenkins work with the various static analysis tools?
Question 31: I have several nodes with the same environment and want jobs to be automatically assigned to idle nodes. Is that possible?
Reference: You only need to configure the same label on these nodes that share the same environment, and have the job specify that label as its run node; Jenkins will then automatically pick an idle node to execute the job. A label in Jenkins carries the sense of a category or group, just like the label feature in WeChat’s contacts. It is simply not designed very conspicuously, so if you don’t know about it, it’s easy to mistake it for a unique ID.
Question 32: How does Jenkins work with the various static analysis tools?
Read moreJenkins: nothing of its own, yet capable of everything
Jenkins is, in essence, an automation server.
Create a job on Jenkins and configure it, and that job will execute automatically in whatever way you want. Archimedes once said, “Give me a fulcrum and I will move the whole earth.” Wozijishuode also said, “Give me a Jenkins and I can automate everything.”
Read more- Question 16: Can a timeout be set with Pipeline code?
- Question 17: Is there a plugin that can monitor changes to the Jenkins configuration?
Question 16: Can a timeout be set with Pipeline code?
Reference: Yes. The following code sets a timeout of 1 hour, and it can be set either globally for the pipeline or at the stage level:
options {
timeout(time: 1, unit: 'HOURS')
}
Question 17: Is there a plugin that can monitor changes to the Jenkins configuration?
Read more- Question 11: How do I trigger other Jenkins jobs from a Pipeline script?
- Question 12: Is there a convenient way to see the list of currently installed plugins and their versions on Jenkins? You can see them under Manage Plugins - Installed, but copying them out brings extra information that is hard to handle. For example, the extra plugin descriptions mean that after pasting into a spreadsheet you still have to delete them one by one manually.
Question 11: How do I trigger other Jenkins jobs from a Pipeline script?
Answer: There is a build step you can look into; it supports both synchronous and asynchronous triggering.
Question 12: Is there a convenient way to see the list of currently installed plugins and their versions on Jenkins? You can see them under Manage Plugins - Installed, but copying them out brings extra information that is hard to handle. For example, the extra plugin descriptions mean that after pasting into a spreadsheet you still have to delete them one by one manually.
Read moreQuestion 6: What is the relationship between Blue Ocean and Jenkins?
Answer: Put simply, Blue Ocean can be seen as a new UI that Jenkins introduced, with a more modern look and better interaction.
Of course, the most important thing is its support for the new pipeline job type introduced in Jenkins 2.x, which can clearly show the serial/parallel relationships and statuses of the various stages in the whole Pipeline.
Read more- Question 1: How do Jenkins and Docker work together?
- Question 2: When writing a pipeline with two stages, the first of which is assigned to a random machine to run on, and the second of which has to run on the same machine as the first, is there any way to do that?
Question 1: How do Jenkins and Docker work together?
Reference: You can combine Jenkins with Docker by using containers as Jenkins agent nodes, which has many advantages. For example, it unifies the execution environment, creates and destroys agents automatically, and removes the cost of maintaining environments by hand.
Question 2: When writing a pipeline with two stages, the first of which is assigned to a random machine to run on, and the second of which has to run on the same machine as the first, is there any way to do that?
Read more
If you configure a dependency in Gradle without specifying a version, the build fails with an error saying the dependency cannot be found.
But when you have a lot of dependencies, you also have to trawl the repository one by one to see what the latest version of each library is.
So does Gradle support using the latest version of a dependency directly?
The answer is yes, though gradle’s documentation doesn’t flag it in any prominent place.
The trick is to put a plus sign + in the version field, and gradle will work out the latest version automatically and download it.
Once everything is pointed at the latest version, you can then work through the few remaining dependency-conflict errors from the log, which saves a great deal of effort.
Read more
Gradle is a very flexible and powerful build system, but its concepts are relatively complex. As long as you grasp the core and keep the distinctions straight, it will not feel confusing.
Does the build script below look hard to understand?
buildscript {
repository for build script dependencies
repositories {
mavenCentral()
}
// build script dependencies
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
}
}
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
implementation 'com.google.guava:guava:30.1-jre'
testImplementation 'junit:junit:4.13.2'
}
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.jvm' version '1.5.10'
}
Once Jenkinsclient is configured, you can operate Jenkins through commands.
The command format of jenkinsclient is:
jenkins GROUP | COMMAND
GROUP refers to a group of commands. For example, job is a group command, and it provides the following commands:
jenkins job build //build a job
jenkins job copy //copy a job
jenkins job create //create a job
jenkins job delete //delete a job
jenkins job disable //disable a job
jenkins job enable //enable a job
jenkins job has //check whether a job already exists
jenkins job info //show job information
jenkins job ls //show the job list
jenkins job rename //rename a job
jenkins job xml //show the contents of a job's config.xml
Today we’ll skip group commands for now and start with the top-level COMMANDs. These commands are mostly used to view various kinds of information.
1. Easter Egg — APP Mode
APP mode lets you operate Jenkins in a standalone window. It feels just like using an app.
Command:
jenkins app
Video demo:
Read moreIntroduction to jenkinsclient
Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client. It provides a Docker-style command line for users to operate Jenkins.
Jenkinsclient is written in Python, and the project source code is open-sourced under China’s Mulan Open Source License. You can view it on Gitee and Github.
Gitee: https://gitee.com/hummerstudio/jenkinsclient
Github: https://github.com/hummerstudio/jenkinsclient
Project homepage: https://pypi.org/project/jenkinsclient
Read moreIntroducing Jenkinsclient
Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client that supports multiple instances. The project is open-sourced under the Mulan open source license.
Version 1.0 was officially released a few days ago.
PyPI project page: https://pypi.org/project/jenkinsclient/
Read moreBackground
Starting a process through Jenkins is a fairly common scenario in real-world work.
But under normal circumstances, a process started by a Jenkins job is killed by Jenkins once the build finishes.
Read moreAutomation is a revolutionary concept and technology.
First-Generation Automation
The first generation of automation is the automation of the heaven-and-earth system: the growth of all things.
Heaven supplies energy as yang, earth takes form as yin; the ancient sages observed this and put it to use. Following the four seasons and adapting to local conditions is what is called wu wei (non-action). Wu wei is not inaction — it is acting in accordance with nature.
The automation of this generation has three elements: heaven, earth and man.
Weather reflects the intensity and total amount of the solar energy supplied. The changes of weather divide broadly into the four seasons and finely into the twenty-four solar terms. Terrain differs from place to place, so one adapts to local conditions; and people must sow, water, fertilize and feed at the right time and in the right place, as if playing in concert with heaven and earth — hence human harmony.
Although heaven and earth are already automated, from the human point of view it still takes the right action at the right moment for all things to grow as humans intend.
Read moreAutomation is a revolutionary concept and technology.
First-Generation Automation
The first generation of automation is the automation of the heaven-and-earth system: the growth of all things.
Heaven supplies energy as yang, earth takes form as yin; the ancient sages observed this and put it to use. Following the four seasons and adapting to local conditions is what is called wu wei (non-action). Wu wei is not inaction — it is acting in accordance with nature.
The automation of this generation has three elements: heaven, earth and man.
Weather reflects the intensity and total amount of the solar energy supplied. The changes of weather divide broadly into the four seasons and finely into the twenty-four solar terms. Terrain differs from place to place, so one adapts to local conditions; and people must sow, water, fertilize and feed at the right time and in the right place, as if playing in concert with heaven and earth — hence human harmony.
Although heaven and earth are already automated, from the human point of view it still takes the right action at the right moment for all things to grow as humans intend.
Read moreThe Jenkins Plugin Center domestic mirror
The 1500+ plugins Jenkins offers are its most valuable resource and its defining feature; they give Jenkins powerful functionality, flexibility, and the ability to connect and interact with other platforms.
Recently, however, users in China have clearly felt that Jenkins downloads plugins very slowly, and that downloads often time out and fail. This problem has caused a great deal of trouble for users in China.
This is mainly because the network infrastructure servers of the Jenkins open source community are all located abroad.
In November 2019, the Jenkins Chinese community released a domestic mirror address.
This mirror solved the problem that other mirrors had always had — that they could not really be used — so that users in China can now download plugins at the full speed their bandwidth allows.
Read moreSymptom
In the Docker Preferences options, “Enabel Kubernetes” is selected to enable Kubernetes, but it stays in the starting state and cannot be used normally.
Cause
To enable the Kubernetes feature, Docker needs to pull the Kubernetes-related images from an image registry.
Because access to Docker Hub is too slow from within China, the images cannot be pulled successfully, which leaves Kubernetes stuck in the starting state.
Groovy syntax overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it has been enhanced with specific types and permits certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax derives from Java syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax derives from Java syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreGroovy Syntax Overview
This tutorial series introduces the syntax of the Groovy programming language. Groovy’s syntax is derived from Java’s syntax, but it is enhanced with specific types and allows certain simplifications.
Read moreOverview
These are all concepts from the Ruby language. Below I introduce the meaning of each term and compare it with similar tools, so that readers can understand them.
Read more
