TT Bigdata TT Bigdata
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件安装

    • 常规&高可用
  • 版本专题

    • 更新说明
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 模板代码

    • 各类组件
    • 通用模板
  • 国产化&其他系统

    • Centos系列
    • Kylin系列
    • OpenEuler系列
    • Rocky系列
    • Ubuntu系列
  • 生产调优

    • 组件调优指南
    • 1v1指导调优
  • 定制开发

    • 组件版本定制
    • 样式风格定制
  • 蓝图愿景
  • 技术支持
  • 合作共建
GitHub (opens new window)

JaneTTR

数据酿造智慧,每一滴都是沉淀!
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件安装

    • 常规&高可用
  • 版本专题

    • 更新说明
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 模板代码

    • 各类组件
    • 通用模板
  • 国产化&其他系统

    • Centos系列
    • Kylin系列
    • OpenEuler系列
    • Rocky系列
    • Ubuntu系列
  • 生产调优

    • 组件调优指南
    • 1v1指导调优
  • 定制开发

    • 组件版本定制
    • 样式风格定制
  • 蓝图愿景
  • 技术支持
  • 合作共建
GitHub (opens new window)
  • Ambari-Env

  • 组件编译

  • 报错解决

  • 其他技巧

    • Maven镜像加速
      • 推荐使用 Maven 3.8.4
      • 🛠️ 一、Maven 设置 Nexus 私服方案
        • 1.1 项目级别配置 (Project-Level)
        • pom.xml 完整配置:
        • 用户名和密码配置:
        • 1.2 全局配置 (Global-Level)
        • settings.xml 配置:
        • 1.3 选择建议:
      • 📦 二、在 Bigtop 项目中编译案例—Zookeeper
        • 2.1 编译日志
        • 2.2 使用 ambari-env 一键解决环境准备问题
        • Step 1 配置直刷指定位置
        • Step 2 统一的模板文件
        • Step 3 编译前自动准备环境
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL 快速安装
    • Temurin JDK 23快速安装
  • 二次开发
  • 其他技巧
JaneTTR
2022-12-18
目录

Maven镜像加速

# 推荐使用 Maven 3.8.4

🔧 原因:在大数据项目中,Maven 3.9 以上版本可能会出现一些编译问题,尤其是在处理复杂依赖时。为了确保编译过程的稳定性,建议使用 Maven 3.8.4 版本。

# 🛠️ 一、Maven 设置 Nexus 私服方案

# 1.1 项目级别配置 (Project-Level)

在项目的 pom.xml 文件中,配置 Nexus 私服并添加用户名和密码的相关配置。

# pom.xml 完整配置:


<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>my-project</artifactId>
    <version>1.0.0</version>

    <!-- 配置私服仓库 -->
    <repositories>
        <repository>
            <id>nexus-releases</id>
            <url>http://your-nexus-server/repository/maven-public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <!-- 发布到私服 -->
    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <url>http://your-nexus-server/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <url>http://your-nexus-server/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
</project>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

🔑 说明:

  • repositories 定义从私服仓库下载依赖。
  • distributionManagement 用于发布构件到私服仓库。

# 用户名和密码配置:

为了保证私服的安全性,用户名和密码不直接写在 pom.xml 中。你可以通过全局的 settings.xml 文件来配置认证信息,避免泄露凭证。

# 1.2 全局配置 (Global-Level)

通过 ~/.m2/settings.xml 来配置用户名和密码,适用于所有 Maven 项目。

# settings.xml 配置:


<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">

    <mirrors>
        <!-- 配置 Nexus 私服为中央仓库的镜像 -->
        <mirror>
            <id>nexus-mirror</id>
            <mirrorOf>central</mirrorOf>
            <url>http://your-nexus-server/repository/maven-public/</url>
        </mirror>
    </mirrors>

    <servers>
        <!-- 配置私服的认证信息 -->
        <server>
            <id>nexus-releases</id>
            <username>your-username</username>
            <password>your-password</password>
        </server>
        <server>
            <id>nexus-snapshots</id>
            <username>your-username</username>
            <password>your-password</password>
        </server>
    </servers>

    <profiles>
        <profile>
            <id>nexus</id>
            <repositories>
                <repository>
                    <id>nexus-releases</id>
                    <url>http://your-nexus-server/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>

    <activeProfiles>
        <!-- 激活 Nexus 配置 -->
        <activeProfile>nexus</activeProfile>
    </activeProfiles>
</settings>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

🔐 说明:

  • servers 标签中包含了用户名 (your-username) 和密码 (your-password) 的配置。
  • 这样就不会在 pom.xml 中暴露敏感信息,保障了安全性。

# 1.3 选择建议:

  • 项目级别:在 pom.xml 中配置私服仓库和发布仓库,而认证信息通过全局 settings.xml 配置。
  • 全局级别:通过 settings.xml 为所有项目配置认证信息,避免在 pom.xml 中泄露敏感信息。

建议将用户名和密码信息安全地存放在 ~/.m2/settings.xml 中,而不是在 pom.xml 中硬编码敏感信息。

本人更倾向于全局设置:

image-20240918152402433

我这里做了统一的汇聚,关联所有的下载镜像:

image-20240918143526908

# 📦 二、在 Bigtop 项目中编译案例—Zookeeper

# 2.1 编译日志

# zookeeper 基于 gradle 打 rpm 的编译
gradle \
zookeeper-rpm \
-PparentDir=/usr/bigtop \
-Dbuildwithdeps=true \
-PpkgSuffix \
-d
1
2
3
4
5
6
7
Downloaded from nexus: http://172.20.0.2:8081/repository/maven-public/org/codehaus/jackson/jackson-core-asl/1.1.1/jackson-core-asl-1.1.1.jar (104 kB at 43 kB/s)
Downloaded from nexus: http://172.20.0.2:8081/repository/maven-public/com/sun/jersey/jersey-client/1.1.5.1/jersey-client-1.1.5.1.jar (90 kB at 37 kB/s)
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ zookeeper-contrib-rest ---
[INFO]
...
1
2
3
4
5
6

# 2.2 使用 ambari-env 一键解决环境准备问题

项目地址: ambari-env: Ambari+Bigtop 一站式编译和部署解决方案 (gitee.com) (opens new window)

# Step 1 配置直刷指定位置

image-20240918152103803

# Step 2 统一的模板文件

image-20240918152014463

# Step 3 编译前自动准备环境

image-20240918150313194

image-20240918151945268

#Maven#Nexus#私服
专区—Bigtop
Gradle镜像加速

← 专区—Bigtop Gradle镜像加速→

最近更新
01
Cyrus SASL/GSASL 缺失解决
06-07
02
Hadoop_3.3.4 编译实战 1.0.0+
06-06
03
Hbase_2.4.13 编译实战 1.0.0+
06-06
更多文章>
Theme by Vdoing | Copyright © 2017-2025 JaneTTR | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式