# 配置私有Maven

低代码平台的后端依赖存放在私有仓库,因此,在同步POM的之前,应该先进行如下配置。

# 修改配置文件

先找到~/.m2/settings.xml

  • Linux/Mac:~/.m2/
  • Windows:%USERPROFILE%\.m2\%USERPROFILE%一般为:C:\User\<账号名>
  • localRepository:指定本地仓库的路径
  • username/password:使用公司的邮箱账号和密码
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!--
   | 仓库地址,用户指定的maven仓库的本地存储公共目录,建议使用绝对路径,避免某些插件识别路径错误
   | 例如,mac: /Users/user/maven/repository,windows: C:\User\yourName\maven\repository
   | 默认值: ${user.home}/.m2/repository-->
  <localRepository>/Users/user/maven/repository</localRepository>
  <servers>
         <server>
            <id>nexus-bingo</id>
            <username>邮箱账号(如:zhangsan)</username>
            <password>账号密码</password>
        </server>
  </servers>

  <mirrors>
    <mirror>
          <id>nexus-aliyun</id>
          <mirrorOf>central</mirrorOf>
          <url>https://maven.aliyun.com/repository/public</url>
    </mirror>
  </mirrors>

      <profiles>    
        <profile>
              <id>bingo</id>
              <repositories>
                <repository>
                      <id>central</id>
                      <url>http://central</url>
                      <releases><enabled>true</enabled></releases>
                      <snapshots><enabled>true</enabled></snapshots>
                </repository>
                <repository>
                      <id>nexus-bingo</id>
                      <url>https://repo.bingosoft.net/repository/public</url>
                      <releases><enabled>true</enabled></releases>
                      <snapshots><enabled>true</enabled></snapshots>
                </repository>
              </repositories>
             <pluginRepositories>
                <pluginRepository>
                      <id>central</id>
                      <url>http://central</url>
                      <releases><enabled>true</enabled></releases>
                      <snapshots><enabled>true</enabled></snapshots>
                </pluginRepository>
              </pluginRepositories>
        </profile>
      </profiles>
      <activeProfiles>
        <activeProfile>bingo</activeProfile>
    </activeProfiles>
</settings>

# 解决SSL问题

由于公司的证书是私有证书,因此,需要将该证书导入到JAVA的jre中:

  1. 下载品高证书文件:

证书文件 (opens new window)

  1. 在文件下载的目录,执行以下脚本:
keytool -import -noprompt -keystore %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit -alias bingosoft.net -file bingo.cer

顶部