为什么'Build Project'失败而Run(Maven配置)成功? [英] Why does 'Build Project' fail whereas Run (Maven configuration) succeed?

查看:1382
本文介绍了为什么'Build Project'失败而Run(Maven配置)成功?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有问题的案例:基于Maven的项目,其Maven运行配置及其命令行参数定义为清理安装

Case in question: A Maven based project that has a Maven Run Configuration with its 'Command line' parameters defined as clean install.

点击绿色箭头调用'Run my_maven_config'从Nexus下载所有必需的包,并成功完成构建。

Clicking the green arrow to invoke 'Run my_maven_config' downloads all necessary packages from Nexus and completes the build successfully.

选择'Build Project'但是,调用一个看似相似的过程但是在成功构建了很长一段时间之后,它在一个丢失的Hibernate包上失败了。

Selecting 'Build Project' however, invokes a seemingly similar process but after building successfully for quite a while, it fails on a missing Hibernate package.

为什么会出现这种差异?

Why is this difference?

Run的构建部分不应该与standalone build相同吗?

Shouldn't the build part of 'Run' be identical to the "standalone build"?

推荐答案

它们不完全相同。 IntelliJ IDEA从Maven导入外部项目模型并将其转换为内部项目模型。它不是100%准确,不支持某些Maven插件,某些依赖可能无法解决等等。

They are not identical. IntelliJ IDEA imports the external project model from Maven and converts it to the internal project model. It's not 100% accurate, some Maven plug-ins are not supported, some dependencies may fail to resolve, etc.

参见这个答案来执行诊断。尝试重新导入项目(如果它没有帮助,首先删除.idea目录)。

See this answer to perform the diagnostics. Try re-importing the project (delete .idea directory first if it doesn't help).

将构建/运行操作委派给Maven,因为现在可以使用Gradle完成稍后将得到支持(可能在IntelliJ IDEA 2018.3中)。

Delegating build/run actions to Maven as it can be done now with Gradle will be supported later (probably in IntelliJ IDEA 2018.3).

这篇关于为什么'Build Project'失败而Run(Maven配置)成功?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆