IDE 中启动
一 在 IDE 中启动,通过 VM options 配置启动参数 -Dvipserver.server.port=8080,通过 main 方法直接启动。
二
如果你的轻量级配置中心与应用部署在不同的机器上,还需进行 hosts 绑定,详情见轻量级配置中心。
FatJar 启动
添加 FatJar 打包插件。
使用 Maven 将 pandora-boot 工程打包成 FatJar, 需要在 pom.xml 中添加如下插件。 为避免与其他打包插件发生冲突,请勿在 build 的 plugin 中添加其他 FatJar 插件。
<build>
<plugin>
<groupId>com.taobao.pandora</groupId>
<artifactId>pandora-boot-maven-plugin</artifactId>
<version>2.1.9.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</build>
添加完插件后,在工程的主目录下,使用 maven 命令 mvn clean package 进行打包,即可在 target 目录下找到打包好的 FatJar 文件。
通过 Java 命令启动。
java -Dvipserver.server.port=8080 -Dpandora.location=/Users/{$username}/.m2/repository/com/taobao/pandora/taobao-hsf.sar/dev-SNAPSHOT/taobao-hsf.sar-dev-SNAPSHOT.jar -jar sc-vip-server-0.0.1-SNAPSHOT.jar
注意 : -Dpandora.location 指定的路径必须是全路径,且必须放在 sc-vip-server-0.0.1-SNAPSHOT.jar 之前。
edas maven 对应的下载配置文件
<settings>
<localRepository>D:/mavenrepository</localRepository> +
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://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>
http://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>
http://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>
</settings>