解决Jenkins中Maven本地仓库更新不及时的问题

问题描述

当私服的内容发生变动或有其他依赖更新时,使用Jenkins构建镜像时还使用老的依赖导致构建失败。
报错如下:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /var/jenkins_home/workspace/xxx-gateway/xxx-gateway/src/main/java/com/xxx/gateway/filter/AuthGlobalFilter.java:[36,83] cannot find symbol
  symbol:   variable JWT_TOKEN_NICK_NAME
  location: class com.xxx.base.constant.Auth
[ERROR] /var/jenkins_home/workspace/xxx-gateway/xxx-gateway/src/main/java/com/xxx/gateway/filter/AuthGlobalFilter.java:[37,82] cannot find symbol
  symbol:   variable JWT_TOKEN_ROLE_IDS
  location: class com.xxx.base.constant.Auth
[ERROR] /var/jenkins_home/workspace/xxx-gateway/xxx-gateway/src/main/java/com/xxx/gateway/filter/AuthGlobalFilter.java:[39,29] cannot find symbol
  symbol:   method builder()

解决方法

配置maven setting.xml文件

				 <repository>
                    <id>xxxid>
                    <url>https://xxxxurl>
                    <releases>
              		    <enabled>trueenabled>
						<updatePolicy>alwaysupdatePolicy>
                    releases>
                    <snapshots>
                        <enabled>trueenabled>
						<updatePolicy>alwaysupdatePolicy>
                    snapshots>
                repository>

关键点在于: enabled -> true,updatePolicy -> true,这样每次构建是都会去刷新依赖。

你可能感兴趣的:(BUG解决,SpringCloud,Java,jenkins,maven,java)