使用Pandora Boot开发HSF应用前,需先配置EDAS的私服地址和轻量级配置及注册中心。
背景信息
目前Spring Cloud for Aliware的第三方包只发布在EDAS的私服中,所以需要在Maven中配置EDAS的私服地址。
本地开发调试时,需要启动轻量级配置注册中心。轻量级配置及注册中心包含了服务发现和配置管理功能。
在Maven中配置EDAS的私服地址
Maven要求3.x及以上版本。
需在Maven配置文件settings.xml中加入EDAS私服地址。
请参考如下示例,在Maven所使用的配置文件(一般为~/.m2/settings.xml)中添加EDAS的私服配置。
<profiles> <profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>https://repo1.maven.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>https://repo1.maven.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> <profile> <id>edas.oss.repo</id> <repositories> <repository> <id>edas-oss-central</id> <name>taobao mirror central</name> <url>https://edas-public.oss-cn-hangzhou.aliyuncs.com/repository</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>edas-oss-plugin-central</id> <url>https://edas-public.oss-cn-hangzhou.aliyuncs.com/repository</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> <activeProfile>edas.oss.repo</activeProfile> </activeProfiles>
执行以下命令,验证配置是否成功。
mvn help:effective-settings
无报错,表明
settings.xml
文件格式没问题。profiles中包含
edas.oss.repo
这个profile,表明私服已经配置至profiles中。activeProfiles中包含
edas.oss.repo
属性,表明edas.oss.repo私服已激活。
如果在命令行执行Maven打包命令无报错,IDE仍无法下载依赖,请关闭IDE重新打开再尝试,或自行查找IDE配置Maven的相关资料。
配置轻量级配置及注册中心
具体操作步骤,请参见启动轻量级配置及注册中心。
该文章对您有帮助吗?
- 本页导读 (1)
- 背景信息
- 在Maven中配置EDAS的私服地址
- 配置轻量级配置及注册中心