从 IDE 运行时插件类路径问题

发布于 2024-10-03 04:53:34 字数 264 浏览 0 评论 0原文

我有一个 Maven 插件,可以在编译后转换类位。从命令行运行时,该插件完全按照设计工作。然而,当 Maven 项目从干净状态构建时,Eclipse (3.6.1) 中就会出现问题。发生的情况是,我在控制台中收到一条错误消息,通知我我的插件由于无法找到实际上位于类路径上的类而失败。

正如我所提到的,当我从命令行构建时,这个插件工作得非常好,所以这是一个相当烦人的问题,似乎有点难以追踪。

以前是否有其他人遇到过这个问题,如果是的话,是否有我缺少的解决方案?

谢谢。

I have a maven plugin that transforms class bits after compilation. This plugin works precisely as designed when run from the command line. However, the problem arises in Eclipse (3.6.1) when the Maven project is building from a clean state. What happens is that I get an error message in the console informing me that my plugin has failed due to the inability to find a class that is in fact on the classpath.

As I mentioned, this plugin works perfectly well when I build from the command line, so this is a rather annoying problem that seems a bit difficult to track down.

Has anyone else ran into this problem before, and if so, is there a solution that I'm missing?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请恋爱 2024-10-10 04:53:34

我可以确认 Maven Eclipse 插件有时与“控制台版本”的工作方式不同。您可以尝试将“Preferences->Maven->Installations”更改为外部 Maven 安装(即从命令行运行时使用的安装)。 Eclipse 插件嵌入版本是 3.0-SNAPSHOT(在我的安装中),可能在所有方面都不稳定。

I can confirm that the maven eclipse plugin sometimes works different than the "console version". You can try to change the "Preferences->Maven->Installations" to your external maven installation (that what you use when running from command line). The eclipse plugin embedded version is a 3.0-SNAPSHOT (in my installation) and maybe not stable in all points.

顾铮苏瑾 2024-10-10 04:53:34

事实证明,该问题是 Maven 2.x 和 Maven 3.x 之间的差异。 m2eclipse 使用的是 Maven 3.x 版本 - 不记得是哪个版本 - 而我正在运行以前的版本。显然,在版本范围内的某个地方,插件 mojo 现在需要 @requiresDependencyResolution 。因此,当在 m2eclipse 中运行时,我的插件没有获取项目中的任何依赖项,因此类路径完全被绑定......

字......

The issue turned out to be a difference between Maven 2.x and Maven 3.x. The m2eclipse was using a version of Maven 3.x - can't remember which - and I was running a previous version. Apparently, somewhere in the version range, the plugin mojo now requires @requiresDependencyResolution . Thus, when running in m2eclipse, my plugin was not getting any of the dependencies in the project, and thus the class path was completely boned...

word...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文