1.首先到 https://jenkins.io/ 下载windows版的 jenkins 2.6.3
2.按照提示下一步,按照提示安装必须的控件,创建用户。
3.输入:http://localhost:8080 看是否可以访问,默认端口:8080
如果想修改端口号为8000
1).修改安装路径下的jenkins.xml
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
修改为:
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8000 --webroot="%BASE%\war"</arguments>
如:D:\mysoft\Jenkins\jenkins.xml
[color=red]系统管理提示:反向代理设置有误[/color]
2).“系统管理”-》“系统设置”,修改Jenkins Location 中的Jenkins URL 中的端口修改
为8000
[img]http://dl2.iteye.com/upload/attachment/0126/7574/1e5916e0-da85-38a6-9223-3ab953b2b02f.png[/img]
4.配置全局的构建工具
系统管理-》Global Tool Configuration 设置 maven,jdk,svn 等
[img]http://dl2.iteye.com/upload/attachment/0126/7576/3b9c8887-21f5-3005-b9b0-19e89cddc7ca.png[/img]
5.新建项目,进行构建
单击“新建”,在下一个页面中设置项目名称,并且选择构建类型(本例选择类型:自由风格的软件项目)。
[img]http://dl2.iteye.com/upload/attachment/0126/7578/c803ebff-75a5-3e2c-a6b3-ade491350475.png[/img]
单击“高级”选择自定义的软件空间,设置项目路径
[img]http://dl2.iteye.com/upload/attachment/0126/7580/00b1fd55-8e41-3da4-a99c-e05244d7bc96.png[/img]
在“构建环境”中选择 Add timestamps to the Console Output
[img]http://dl2.iteye.com/upload/attachment/0126/7584/d886d13e-39dc-3020-927a-e5fc612ba054.png[/img]
设置“构建”
Maven Version: 设为maven路径(已经在Global Tool Configuration 中设置可以选择设置好的maven)
POM:pom.xml (项目配置文件)
File path: C:\Users\gjp\.m2\settings.xml(maven全局配置文件)
[img]http://dl2.iteye.com/upload/attachment/0126/7587/0406b22a-7928-3af5-8c64-ad9f42ffd991.png[/img]
6.单击 “立即构建”,发现构造失败,失败信息如下:
[img]http://dl2.iteye.com/upload/attachment/0126/7589/67e4655f-b8d0-3f4c-80c1-f58b544ff2d6.png[/img]
修改pom.xml
添加如下:
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
然后 单击“立即构建”,完成了构建。
查看日志:
[color=brown]10:10:58 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
10:10:58
10:10:58 [INFO]
10:10:58 [INFO] --- maven-war-plugin:2.3:war (default-war) @ ssm_dream ---
10:10:58 [INFO] Packaging webapp
10:10:58 [INFO] Assembling webapp [ssm_dream] in [E:\2017rocketmq\ssm_dream\target\ssm_dream-0.0.1-SNAPSHOT]
10:10:58 [INFO] Processing war project
10:10:58 [INFO] Copying webapp resources [E:\2017rocketmq\ssm_dream\src\main\webapp]
10:10:58 [INFO] Webapp assembled in [26 msecs]
10:10:58 [INFO] Building war: E:\2017rocketmq\ssm_dream\target\ssm_dream-0.0.1-SNAPSHOT.war
10:10:58 [INFO]
10:10:58 [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ssm_dream ---
10:10:58 [INFO] Installing E:\2017rocketmq\ssm_dream\target\ssm_dream-0.0.1-SNAPSHOT.war to C:\Windows\System32\config\systemprofile\.m2\repository\com\boce\itdream\ssm_dream\0.0.1-SNAPSHOT\ssm_dream-0.0.1-SNAPSHOT.war
10:10:58 [INFO] Installing E:\2017rocketmq\ssm_dream\pom.xml to C:\Windows\System32\config\systemprofile\.m2\repository\com\boce\itdream\ssm_dream\0.0.1-SNAPSHOT\ssm_dream-0.0.1-SNAPSHOT.pom
10:10:58 [INFO] ------------------------------------------------------------------------
10:10:58 [INFO] BUILD SUCCESS
10:10:58 [INFO] ------------------------------------------------------------------------
10:10:58 [INFO] Total time: 1.843 s
10:10:58 [INFO] Finished at: 2017-08-31T10:10:58+08:00
10:10:59 [INFO] Final Memory: 11M/27M
10:10:59 [INFO] ------------------------------------------------------------------------
10:10:59 Finished: SUCCESS[/color]
7.把程序远程发布到 tomcat 7上,
1》 系统管理-》插件管理 安装 Deploy to container Plugin
2》修改tomcat中的 tomcat-users.xml
修改为:
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui" username="admin"/>
注意:username,password 的值可以修改。
3》启动tomcat ,并且测试使用admin用户是否可以登录。
4.》开始设置远程发布:
单击“my view” 单击“ssm_dream”(项目名), 单击“配置”。
构建后操作,选择deploy war/ear to container
WAR/EAR files :发布包路径
Context path:访问别名 如:http://localhost:9999/ssm
Credentials: Tomcat的用户名和密码
Tomcat URL:tomcat 访问路径 如:http://localhost:9999
[img]http://dl2.iteye.com/upload/attachment/0126/7595/89ebf2a9-7dba-37e0-98ac-9ec8d46d0c23.png[/img]
去tomcat路径下看看,文件是否发布成功:
[img]http://dl2.iteye.com/upload/attachment/0126/7599/7f46e066-964a-31fa-a441-cdd125c6e15e.png[/img]
文件发布成功
2.按照提示下一步,按照提示安装必须的控件,创建用户。
3.输入:http://localhost:8080 看是否可以访问,默认端口:8080
如果想修改端口号为8000
1).修改安装路径下的jenkins.xml
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
修改为:
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8000 --webroot="%BASE%\war"</arguments>
如:D:\mysoft\Jenkins\jenkins.xml
[color=red]系统管理提示:反向代理设置有误[/color]
2).“系统管理”-》“系统设置”,修改Jenkins Location 中的Jenkins URL 中的端口修改
为8000
[img]http://dl2.iteye.com/upload/attachment/0126/7574/1e5916e0-da85-38a6-9223-3ab953b2b02f.png[/img]
4.配置全局的构建工具
系统管理-》Global Tool Configuration 设置 maven,jdk,svn 等
[img]http://dl2.iteye.com/upload/attachment/0126/7576/3b9c8887-21f5-3005-b9b0-19e89cddc7ca.png[/img]
5.新建项目,进行构建
单击“新建”,在下一个页面中设置项目名称,并且选择构建类型(本例选择类型:自由风格的软件项目)。
[img]http://dl2.iteye.com/upload/attachment/0126/7578/c803ebff-75a5-3e2c-a6b3-ade491350475.png[/img]
单击“高级”选择自定义的软件空间,设置项目路径
[img]http://dl2.iteye.com/upload/attachment/0126/7580/00b1fd55-8e41-3da4-a99c-e05244d7bc96.png[/img]
在“构建环境”中选择 Add timestamps to the Console Output
[img]http://dl2.iteye.com/upload/attachment/0126/7584/d886d13e-39dc-3020-927a-e5fc612ba054.png[/img]
设置“构建”
Maven Version: 设为maven路径(已经在Global Tool Configuration 中设置可以选择设置好的maven)
POM:pom.xml (项目配置文件)
File path: C:\Users\gjp\.m2\settings.xml(maven全局配置文件)
[img]http://dl2.iteye.com/upload/attachment/0126/7587/0406b22a-7928-3af5-8c64-ad9f42ffd991.png[/img]
6.单击 “立即构建”,发现构造失败,失败信息如下:
[img]http://dl2.iteye.com/upload/attachment/0126/7589/67e4655f-b8d0-3f4c-80c1-f58b544ff2d6.png[/img]
修改pom.xml
添加如下:
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
然后 单击“立即构建”,完成了构建。
查看日志:
[color=brown]10:10:58 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
10:10:58
10:10:58 [INFO]
10:10:58 [INFO] --- maven-war-plugin:2.3:war (default-war) @ ssm_dream ---
10:10:58 [INFO] Packaging webapp
10:10:58 [INFO] Assembling webapp [ssm_dream] in [E:\2017rocketmq\ssm_dream\target\ssm_dream-0.0.1-SNAPSHOT]
10:10:58 [INFO] Processing war project
10:10:58 [INFO] Copying webapp resources [E:\2017rocketmq\ssm_dream\src\main\webapp]
10:10:58 [INFO] Webapp assembled in [26 msecs]
10:10:58 [INFO] Building war: E:\2017rocketmq\ssm_dream\target\ssm_dream-0.0.1-SNAPSHOT.war
10:10:58 [INFO]
10:10:58 [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ssm_dream ---
10:10:58 [INFO] Installing E:\2017rocketmq\ssm_dream\target\ssm_dream-0.0.1-SNAPSHOT.war to C:\Windows\System32\config\systemprofile\.m2\repository\com\boce\itdream\ssm_dream\0.0.1-SNAPSHOT\ssm_dream-0.0.1-SNAPSHOT.war
10:10:58 [INFO] Installing E:\2017rocketmq\ssm_dream\pom.xml to C:\Windows\System32\config\systemprofile\.m2\repository\com\boce\itdream\ssm_dream\0.0.1-SNAPSHOT\ssm_dream-0.0.1-SNAPSHOT.pom
10:10:58 [INFO] ------------------------------------------------------------------------
10:10:58 [INFO] BUILD SUCCESS
10:10:58 [INFO] ------------------------------------------------------------------------
10:10:58 [INFO] Total time: 1.843 s
10:10:58 [INFO] Finished at: 2017-08-31T10:10:58+08:00
10:10:59 [INFO] Final Memory: 11M/27M
10:10:59 [INFO] ------------------------------------------------------------------------
10:10:59 Finished: SUCCESS[/color]
7.把程序远程发布到 tomcat 7上,
1》 系统管理-》插件管理 安装 Deploy to container Plugin
2》修改tomcat中的 tomcat-users.xml
修改为:
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui" username="admin"/>
注意:username,password 的值可以修改。
3》启动tomcat ,并且测试使用admin用户是否可以登录。
4.》开始设置远程发布:
单击“my view” 单击“ssm_dream”(项目名), 单击“配置”。
构建后操作,选择deploy war/ear to container
WAR/EAR files :发布包路径
Context path:访问别名 如:http://localhost:9999/ssm
Credentials: Tomcat的用户名和密码
Tomcat URL:tomcat 访问路径 如:http://localhost:9999
[img]http://dl2.iteye.com/upload/attachment/0126/7595/89ebf2a9-7dba-37e0-98ac-9ec8d46d0c23.png[/img]
去tomcat路径下看看,文件是否发布成功:
[img]http://dl2.iteye.com/upload/attachment/0126/7599/7f46e066-964a-31fa-a441-cdd125c6e15e.png[/img]
文件发布成功