Maven

配置方式

在配置中如果需要使用特定的Maven配置属性(maven私服,代理或者其他)或者运行一个需要代理的Data Flow 服务,你需要在启动服务的时候配置对应属性作为启动命令,如下:

$ java -jar spring-cloud-dataflow-server-2.1.0.RELEASE.jar \
       --spring.config.additional-location=/home/joe/maven.yml &

其中maven.yaml的配置是

maven:
  localRepository: mylocal
  remote-repositories:
    repo1:
      url: https://repo1
      auth:
        username: user1
        password: pass1
      snapshot-policy:
        update-policy: daily
        checksum-policy: warn
      release-policy:
        update-policy: never
        checksum-policy: fail
    repo2:
      url: https://repo2
      policy:
        update-policy: always
        checksum-policy: fail
  proxy:
    host: proxy1
    port: "9010"
    auth:
      username: proxyuser1
      password: proxypass1

通常情况下,协议默认使用 http 。如果代理配置不需要使用用户名和密码,可以忽略auth配置。Maven 默认的 localRepository设置为${user.home}/.m2/repository/。如以上配置所示,可以指定远程的maven库以及私服并且配置对应的身份验证。如果远程库需要使用代理,可以按照以上模版进行配置。

可以为每一远程存储库配置不同的策略模式,如上例所示。policy 配置了 snapshotrelease 的存储策略。

您可以参考存储库策略以获取支持的存储库策略列表。

这些配置是Spring Boot @ConfigurationProperties 的启动配置,你可以将它们添加到SPRING_APPLICATION_JSON 中,如下:

Last updated

Was this helpful?