简体   繁体   English

console和eclipse maven有什么区别

[英]What is the difference between console and eclipse maven

I mean is there any difference between the maven you download and manually install/run from the one eclipse has embedded as an eclipse plugin? 我的意思是您下载的Maven与从作为eclipse插件嵌入的一个Eclipse手动安装/运行的Maven之间有什么区别吗? The reason why I ask is that, my project builds successfully in eclipse, but I get this annoying error when building from console mvn install , here is the error 我问的原因是,我的项目在eclipse中成功构建,但是从console mvn install构建时却遇到了这个烦人的错误,这是错误

Reason: Cannot find parent: net.oauth:oauth-parent for pro core.... 原因:找不到亲:net.oauth:亲核心的oauth-parent。

I can fix this by manually removing parent tags from oauth pom and one other pom .. and it will build successfully, is there something else I can do to fix this? 我可以通过从oauth pom和一个其他pom中手动删除父标签来解决此问题,它会成功构建,还有什么其他方法可以解决吗? what could be the problem with console? 控制台可能是什么问题? When the time to build a project comes it will be from console not from eclipse .. thank you 当构建项目的时间到了,它将来自控制台而不是eclipse ..谢谢

EDIT 编辑

Is there a way to say maven .. ok just ignore those errors and continue with the build, cause that is obviously what eclipse is doing since there is no parent-oauth-project on the repository when the build succeeds with eclipse. 有没有办法说Maven ..好的,只需忽略这些错误并继续构建,原因显然是eclipse所做的,因为在构建成功执行eclipse时,存储库中没有parent-oauth-project

While it is possible to add an external maven install and thus to use the same version for the build inside Eclipse and on the command line, there might be differences for dependency resolution as mentioned in the note shown below: 尽管可以添加一个外部 maven安装,从而在Eclipse内部和命令行中使用相同的版本进行构建 ,但是依赖关系解析可能会有所不同如下所示:

alt text http://img401.imageshack.us/img401/2455/screenshot008i.png 替代文字http://img401.imageshack.us/img401/2455/screenshot008i.png

So, if the versions differ, one can imagine to have slight differences in the behavior (but I'd be extremely surprised to be honest). 因此,如果版本不同,则可以想象行为上会有细微的差异(但老实说,我会感到非常惊讶)。

The problem here is that it's not possible to reproduce your problem as you didn't post your POM (or at least the relevant parts, ie the "culprit" dependency and the repository it comes from). 这里的问题是,由于您没有发布POM(或至少相关部分,即“罪魁祸首”依赖性及其来源),因此无法重现您的问题。

So please, update your question :) 所以,请更新您的问题:)

The Eclipse plugin will resolve dependencies from the workspace, so if you have a project with the Maven ID net.oauth:oauth-parent in the workspace, the plugin will use it. Eclipse插件将解析工作空间中的依赖项,因此,如果您在工作空间中具有Maven ID net.oauth:oauth-parent的项目,则该插件将使用它。

The command line Maven just searches your local repository. 命令行Maven仅搜索您的本地存储库。

The solution for your bug is to run mvn install in the oauth-parent project to install the artifact in your local repository. 针对您的错误的解决方案是在oauth-parent项目中运行mvn install ,以将工件安装在本地存储库中。 Note that you must do this every time you change the parent project! 请注意,每次更改父项目时都必须执行此操作!

They can be different. 它们可以不同。 You can verify under which maven version you run with the --version goal. 您可以使用--version目标验证在哪个Maven版本上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM