Jenkins 通过maven打包时,发现resource下的properties 配置文件未生成 ,导致在执行时报错

场景: Jenkins 构建WebDriver 项目时,报如下图错误:


Jenkins 通过maven打包时,发现resource下的properties 配置文件未生成 ,导致在执行时报错


idea 运行时是没问题的,经过对比发现是因为Jenkins构建时,发现resource下的properties 配置文件未生成,找到不所以才提示错误


解决方法:

代码路径:

Jenkins 通过maven打包时,发现resource下的properties 配置文件未生成 ,导致在执行时报错


在pom.xml 中bulid  页签中添加如下配置:

<resources>
  <resource>
    <directory>src/main/resource</directory>
  </resource>
</resources>

Jenkins 通过maven打包时,发现resource下的properties 配置文件未生成 ,导致在执行时报错


directory 值是根据 resource 中的路径来填写的

添加完之后,构建即可成功。