1. Install JENKINS
The first is to download the installation package of jenkins for windows directly on the http://jenkins-ci.org/ page. After downloading, you can install it.
The second is to download the war package of jenkins and execute the war package with the java command, such as java -jar jenkins.war
When running, you can add some parameters later, such as -httpPort=8082, etc., in this case, to prevent the port from being occupied, the specific parameter list is as follows
Command Line Parameter Description
--httpPort=$HTTP_PORT | Runs Jenkins listener on port $HTTP_PORT using standard http protocol. The default is port 8080. To disable (because you're using https), use port -1. |
--httpListenAddress=$HTTP_HOST | Binds Jenkins to the IP address represented by $HTTP_HOST. The default is 0.0.0.0 — i.e. listening on all available interfaces. For example, to only listen for requests from localhost, you could use: --httpListenAddress=127.0.0.1 |
--httpsPort=$HTTP_PORT | Uses HTTPS protocol on port $HTTP_PORT |
--httpsListenAddress=$HTTPS_HOST | Binds Jenkins to listen for HTTPS requests on the IP address represented by $HTTPS_HOST. |
--ajp13Port = $ AJP_PORT | Runs Jenkins listener on port $AJP_PORT using standard AJP13 protocol. The default is port 8009. To disable (because you're using https), use port -1. |
--ajp13ListenAddress = $ AJP_HOST | Binds Jenkins to the IP address represented by $AJP_HOST. The default is 0.0.0.0 — i.e. listening on all available interfaces. |
--argumentsRealm.passwd.$ADMIN_USER | Sets the password for user $ADMIN_USER. If Jenkins security is turned on, you must log in as the $ADMIN_USER in order to configure Jenkins or a Jenkins project. NOTE: You must also specify that this user has an admin role. (See next argument below). |
--argumentsRealm.roles.$ADMIN_USER=admin | Sets that $ADMIN_USER is an administrative user and can configure Jenkins if Jenkins' security is turned on. SeeSecuring Jenkins for more information. |
-Xdebug -Xrunjdwp:transport=dt_socket,address=$DEBUG_PORT,server=y,suspend=n | Sets debugging on and you can access debug on $DEBUG_PORT. |
- |
Logging to desired file |
-XX:PermSize=512M -XX:MaxPermSize=2048M -Xmn128M -Xms1024M -Xmx2048M | referring to these options for Oracle Java |
After running, enter the jenkins system: http://<hostname>: your port number (default 8080)/
Select Manage JENKINS (Manage Jenkins) on the left side of the menu, and find install as windows service
After selecting the installation path, the next thing is to drink a glass of water and wait for the installation to be successful.
2. Configure JENKINS
Install a few plugins before. deploy plugin. (GIT plugin) optional
The method of installing plug-ins: System Management -> Plug-in Management -> Optional Plug-ins, find what you need in it, and click to install it.
1. To create a job, generally choose a maven project. If your project is not managed by maven, I still recommend you to use it.
2. After entering the second page, set up source code management tools, svn, git (install a git plugin for jenkins before using git), etc., set up your source code path, and set up your credential (username, password), ssh key
3. Set the job schedule, click POLL SCM on the page to display the input box, enter your schedule in it. For example, mine is H/30 * * * * Check every half hour to see if there is an update, and start building if there is.
4. The automatic build settings have been completed, and the built target file will be stored in $JENKINS_HOME$\jobs\$your_job_name$\workspace\target\ here.
5. If you need to deploy automatically, you also need to configure it. In the post-build operation, select deploy war/ear, and the file path should be a relative path, such as target/test.war, fill in your project name in Context path, and then Then enter the username and password of the server, etc. If you use tomcat, you need the user to have manager-secret permissions. Then write the server URL
At this point all the configuration is complete. You can try to build once