从keycloak从GitHub下载代码运行
我的运行环境是windows11,jdk11+maven3.6.3,官方是说是**请确保您已经安装了 JDK 11 (或更高版本)、Maven 3.5.4 (或更高版本) **
使用管理员权限运行CMD
进入keycloak目录,运行下面命令
![在这里插入图片描述](https://img-blog.csdnimg.cn/8df5c58f2e564714b28a177569b3a2da.png
mvn clean install -DskipTests
然后祝你好运,一堆报错
**maven依赖包报错
Plugin org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-enforcer-plugin:jar:3.0.0-M3: Could not transfer artifact org.apache.maven.plugins:maven-enforcer-plugin:pom:3.0.0-M3 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-enforcer-plugin/3.0.0-M3/maven-enforcer-plugin-3.0.0-M3.pom: Unknown host repo.maven.apache.org -> [Help 1]
换国内镜像,找到 Maven 的安装目录,进入 conf 文件夹,编辑 settings.xml 文件,在 标签中添加以下内容
<mirrors>
<mirror>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
npm 下载报错
Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.0:npm (npm-install-common) on project keycloak-themes: Failed to run task: 'npm ci --no-optional --ignore-scripts' failed. org.apache.commons.exec.ExecuteExcept
ion: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
解决方法是找到代码根目录下的pom.xml 加configuration,增加镜像地址
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend.plugin.version}</version>
<configuration>
<registryUrl>https://registry.npm.taobao.org/</registryUrl>
</configuration>
</plugin>