TT Bigdata TT Bigdata
首页
  • 部署专题

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

    • 安装指导
    • 开启 Kerberos
    • 魔改分享
  • 版本专题

    • 更新说明
    • BUG临时处理
  • 实验室

    • VIEW插件
    • JIRA速查
  • Ambari-Env

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

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

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

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

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

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

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

    • Kylin V10系列
    • Rocky系列
    • Ubuntu系列
  • Grafana监控方案

    • Ambari-Metrics插件
    • Infinity插件
  • 支持&共建

    • 蓝图愿景
    • 合作共建
登陆
GitHub (opens new window)

JaneTTR

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

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

    • 安装指导
    • 开启 Kerberos
    • 魔改分享
  • 版本专题

    • 更新说明
    • BUG临时处理
  • 实验室

    • VIEW插件
    • JIRA速查
  • Ambari-Env

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

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

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

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

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

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

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

    • Kylin V10系列
    • Rocky系列
    • Ubuntu系列
  • Grafana监控方案

    • Ambari-Metrics插件
    • Infinity插件
  • 支持&共建

    • 蓝图愿景
    • 合作共建
登陆
GitHub (opens new window)
  • Ambari Views

    • MDEP-187 从根因到修复
      • 一、问题背景
      • 二、问题根因分析
        • 1、执行阶段错误
      • 三、修复点一:修改 capacity-scheduler 模块
        • 1、原始配置(错误示例)
        • 2、修改方案
        • 3、注释掉原 lib 拷贝资源段
      • 四、修复点二:修改 files 模块
        • 1、原始配置
        • 2、替换后的正确写法
      • 五、验证与重新编译
      • 六、补丁方式自动修复(推荐)
    • Loading node labels问题解决
  • Ambari

  • Ambari-infra

  • Ambari-metrics

  • 报错解决-Ambari
  • Ambari Views
JaneTTR
2025-10-30
目录

MDEP-187 从根因到修复

温馨提示

此内容版本在 ttr-2.2.1 已经修复,低于该版本需要手动处理。有任何问题可以联系作者,或者访问 TTBigdata知识库 (opens new window) 获取其他技术支持。

# 一、问题背景

在编译 Ambari Views 模块时,常会遇到以下错误:

典型报错信息如下:

[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@518cf84a
[DEBUG]   (s) silent = false
[DEBUG]   (s) skip = false
[DEBUG]   (f) stripClassifier = false
[DEBUG]   (s) stripVersion = false
[DEBUG]   (f) useBaseVersion = true
[DEBUG]   (s) useRepositoryLayout = false
[DEBUG]   (s) useSubDirectoryPerArtifact = false
[DEBUG]   (s) useSubDirectoryPerScope = false
[DEBUG]   (s) useSubDirectoryPerType = false
[DEBUG] -- end configuration --
[INFO] Copying classes to /opt/modules/ambari3/contrib/views/files/target/lib/ambari-views-utils-3.0.0.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Ambari Contrib Views 3.0.0.0.0:
[INFO]
[INFO] Ambari Contrib Views ............................... SUCCESS [  4.940 s]
[INFO] Ambari View Utils .................................. SUCCESS [ 29.083 s]
[INFO] Ambari View Commons ................................ SUCCESS [ 18.491 s]
[INFO] Files .............................................. FAILURE [ 48.178 s]
[INFO] Capacity Scheduler ................................. SKIPPED
[INFO] Ambari Views Package ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:40 min
[INFO] Finished at: 2025-10-24T06:44:06Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy-dependencies (default) on project files: Artifact has not been packaged yet. When used on reactor artifact, copy shou
ld be executed after packaging: see MDEP-187. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy-dependencies (default) on project files: Artifact has not been packag
ed yet. When used on reactor artifact, copy should be executed after packaging: see MDEP-187.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:569)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Artifact has not been packaged yet. When used on reactor artifact, copy should be executed after packaging: see MDEP-187.
    at org.apache.maven.plugins.dependency.AbstractDependencyMojo.copyFile (AbstractDependencyMojo.java:180)
    at org.apache.maven.plugins.dependency.fromDependencies.CopyDependenciesMojo.copyArtifact (CopyDependenciesMojo.java:249)
    at org.apache.maven.plugins.dependency.fromDependencies.CopyDependenciesMojo.doExecute (CopyDependenciesMojo.java:124)
    at org.apache.maven.plugins.dependency.AbstractDependencyMojo.execute (AbstractDependencyMojo.java:143)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:569)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :files
(base) [root@rocky8 views]#

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

问题说明

报错关键字 MDEP-187 表示在多模块构建时,maven-dependency-plugin 试图复制尚未打包的依赖, 导致当前模块找不到目标 artifact 文件(即 jar 未生成),从而触发构建失败。

其根因是 copy-dependencies 阶段执行得过早,还没到 artifact 打包完毕的生命周期阶段。

# 二、问题根因分析

# 1、执行阶段错误

在原始配置中,copy-dependencies 位于 generate-resources 阶段:


<execution>
    <phase>generate-resources</phase>
    <goals>
        <goal>copy-dependencies</goal>
    </goals>
    <configuration>
        <outputDirectory>${project.build.directory}/lib</outputDirectory>
        <includeScope>runtime</includeScope>
    </configuration>
</execution>
1
2
3
4
5
6
7
8
9
10
11

而 Maven 的生命周期顺序中:

validate → compile → test → package → verify → install → deploy
1

在 generate-resources 阶段执行 copy-dependencies,意味着此时依赖 jar 尚未打包生成,因此出现:

Artifact has not been packaged yet

即:maven-dependency-plugin 在尝试复制目标 jar 时发现文件不存在。

# 三、修复点一:修改 capacity-scheduler 模块

contrib/views/capacity-scheduler/pom.xml
1

# 1、原始配置(错误示例)


<execution>
    <phase>generate-resources</phase>
    <goals>
        <goal>copy-dependencies</goal>
    </goals>
    <configuration>
        <outputDirectory>${project.build.directory}/lib</outputDirectory>
        <includeScope>runtime</includeScope>
    </configuration>
</execution>
1
2
3
4
5
6
7
8
9
10
11

# 2、修改方案

将执行阶段调整为 prepare-package,同时指定输出目录到 classes/WEB-INF/lib:

<!-- 复制运行时依赖到 classes/WEB-INF/lib;放到 prepare-package,避免 MDEP-187 -->
<execution>
    <id>copy-lib-dependencies</id>
    <phase>prepare-package</phase>
    <goals>
        <goal>copy-dependencies</goal>
    </goals>
    <configuration>
        <!-- 直接写进 target/classes/WEB-INF/lib -->
        <outputDirectory>${project.build.outputDirectory}/WEB-INF/lib</outputDirectory>
        <includeScope>runtime</includeScope>
        <overWriteReleases>true</overWriteReleases>
        <overWriteSnapshots>true</overWriteSnapshots>
        <overWriteIfNewer>true</overWriteIfNewer>
    </configuration>
</execution>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# 3、注释掉原 lib 拷贝资源段

<!-- 注释掉旧资源拷贝段 -->
<!--
<resource>
    <targetPath>WEB-INF/lib</targetPath>
    <filtering>false</filtering>
    <directory>target/lib</directory>
</resource>
-->
1
2
3
4
5
6
7
8

# 四、修复点二:修改 files 模块

contrib/views/files/pom.xml
1

# 1、原始配置


<execution>
    <phase>generate-resources</phase>
    <goals>
        <goal>copy-dependencies</goal>
    </goals>
    <configuration>
        <outputDirectory>${project.build.directory}/lib</outputDirectory>
        <includeScope>runtime</includeScope>
    </configuration>
</execution>
1
2
3
4
5
6
7
8
9
10
11

# 2、替换后的正确写法

<!-- 在 prepare-package 再复制依赖,避免 MDEP-187,并直接进 classes/WEB-INF/lib -->
<execution>
    <id>copy-lib-dependencies</id>
    <phase>prepare-package</phase>
    <goals>
        <goal>copy-dependencies</goal>
    </goals>
    <configuration>
        <outputDirectory>${project.build.outputDirectory}/WEB-INF/lib</outputDirectory>
        <includeScope>runtime</includeScope>
        <overWriteReleases>true</overWriteReleases>
        <overWriteSnapshots>true</overWriteSnapshots>
        <overWriteIfNewer>true</overWriteIfNewer>
    </configuration>
</execution>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# 五、验证与重新编译

两处修改完成后,重新执行编译命令:

# 使用 JDK 17
export JAVA_HOME=/opt/modules/jdk-17.0.2
export PATH=$JAVA_HOME/bin:$PATH

java -version

# 编译 Views 子模块
cd /opt/modules/ambari3/contrib/views
mvn clean install -DskipTests
1
2
3
4
5
6
7
8
9

编译结果

当日志显示 所有 Views 模块 SUCCESS,即代表 MDEP-187 已修复。

# 六、补丁方式自动修复(推荐)

如果你使用的是 ambari-env 环境,可以直接使用补丁脚本修复:

https://github.com/TtBigdata/ambari-env/blob/dev/scripts/build/ambari3/common/patch2_2_1/patch2-VIEWS-COMPILE-FIXED.diff
1

该补丁会自动调整两个 POM 文件中的执行阶段与路径,确保后续构建稳定。

#Ambari#Ambari-Admin#Maven#Bower#OpenSSL#HTTP/2#HTTP/1.1#构建失败#MDEP-187
Loading node labels问题解决

Loading node labels问题解决→

最近更新
01
Ambari开启Kerberos认证加密类型错误 Kylin V10
11-05
02
KERBEROS SERVICE CHECK 报错
11-04
03
Test Kerberos Client报错:Failed to kinit
11-04
更多文章>
Theme by Vdoing | Copyright © 2017-2025 JaneTTR | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式