简体   繁体   English

Maven项目在“全新安装”之前起作用。 为什么?

[英]Maven project worked before “clean install”. Why?

I have two maven projects and both are working fine independently. 我有两个Maven项目,两个项目都可以独立正常运行。 I am able to create a jar file and run it from console as well as from eclipse. 我能够创建一个jar文件,并从控制台以及Eclipse中运行它。

I copied over some classes from the second project into the first and made a few changes so that it runs as a single project with features from both. 我将第二个项目中的某些类复制到第一个项目中,并进行了一些更改,以使其作为具有两个功能的单个项目运行。

I have two pom files, so I combined them into a single pom file. 我有两个pom文件,因此我将它们合并为一个pom文件。

The thing is that I am able to run it from eclipse fine and able to get the output I was hoping for. 问题是,我能够从Eclipse正常运行,并能够获得我希望的输出。 But I am not able to run it after executing the jar file created from "mvn package". 但是执行从“ mvn软件包”创建的jar文件后,我无法运行它。

I am using shade maven plugin. 我正在使用阴影Maven插件。

If I use maven build.. with clean install as goal, it again showing errors. 如果我以干净安装为目标使用maven build ..,它将再次显示错误。

My question is this, why this discrepancy? 我的问题是,为什么会有这种差异?

We would need more information to correctly diagnose the issue. 我们将需要更多信息来正确诊断问题。 One thing to look at is to ensure that any changes to dependencies which are projects in Eclipse have been installed as a command line build will only look in your repo, not at your Eclipse project. 要注意的一件事是,确保对作为项目安装的Eclipse项目中的依赖项所做的任何更改都只会在您的存储库中查看,而不会在Eclipse项目中查看。

This may happen when you have a dependency which exists as an open project in your eclipse workspace. 当您的依赖项在Eclipse工作区中作为打开的项目存在时,可能会发生这种情况。

Try closing every project except the one where you're having this problem. 尝试关闭所有项目,但遇到问题的项目除外。 Does it still compile in eclipse then? 那它还在Eclipse中编译吗?

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

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