您的位置:首页 > 其它

老李分享:持续集成学好jenkins之Git和Maven配置 2

2016-01-19 17:31 543 查看
8.检查代码更新并编译

可以通过Poll SCM来设置定时检查编译功能

比如*/5 * * * * 就是每隔5分钟检查一次,如果git仓库中有更新,则执行build操作。

9.使用Maven私服加快下载速度

参阅:http://blog.csdn.net/sheismylife/article/details/7209722

Jenkins的.m2目录路径在:/var/lib/jenkins/.m2/

先清空所有jar包,后创建settings.xml文件,编辑内容如下:

<settings>

<mirrors>

<mirror>

<!--This sends everything else to /public -->

<id>nexus</id>

<mirrorOf>*</mirrorOf>

<url>http://S1:8081/nexus/content/groups/public</url>

</mirror>

</mirrors>

<profiles>

<profile>

<id>nexus</id>

<!--Enable snapshots for the built in central repo to direct -->

<!--all requests to nexus via the mirror -->

<repositories>

<repository>

<id>central</id>

<url>http://central</url>

<releases><enabled>true</enabled></releases>

<snapshots><enabled>true</enabled></snapshots>

</repository>

</repositories>

<pluginRepositories>

<pluginRepository>

<id>central</id>

<url>http://central</url>

<releases><enabled>true</enabled></releases>

<snapshots><enabled>true</enabled></snapshots>

</pluginRepository>

</pluginRepositories>

</profile>

</profiles>

<activeProfiles>

<!--make the profile active all the time -->

<activeProfile>nexus</activeProfile>

</activeProfiles>

</settings>

现在点击build now测试一下,打开console output,看看命令行输出结果,如果发现从S1下载jar包,就正确。和不用私服的比较了一下,节省了1分多钟.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: