如何在Eclipse动态Web项目中将类路径条目添加为发布/导出依赖项?

如何在Eclipse动态Web项目中将类路径条目添加为发布/导出依赖项?

问题描述:

我使用 Wicket quickstart 成功创建了一个项目,并将其转换为Eclipse动态Web项目,方法是运行



I successfully created a project using Wicket quickstart and turned it into an Eclipse dynamic web project by running


mvn eclipse:clean eclipse:eclipse -Dwtpversion = 2.0

mvn eclipse:clean eclipse:eclipse -Dwtpversion=2.0

我将项目导入到Eclipse中,没有任何问题,但是每个JAR都收到这个警告:

I imported the project to Eclipse without any issues, but got this warning for each JAR:


类路径条目M2_REPO / * *。jar不会被导出或发布。

可能会导致运行时ClassNotFoundException。

Classpath entry M2_REPO/**.jar will not be exported or published.
Runtime ClassNotFoundExceptions may result.

我可以通过在每个警告上使用右键单击→QuickFix 来修复此问题,并选择将关联的原始类路径条目标记为发布/导出依赖关系,但这需要很多如果有很多依赖关系,那么时间是不可能的。

I can fix this by using right click → QuickFix on each warning and selecting "Mark the associated raw classpath entry as a publish/export dependency," but this takes a lot of time and would not be possible if there were a lot of dependencies.

必须有一种方式让Maven为我做这个;这是什么?

There must be a way to have Maven do this for me; what is it?

编辑:我发现使用 m2eclipse 核心+ Maven集成的WTP(从m2eclipse extras)解决了我的问题。

I've found out that using m2eclipse core + Maven Integration for WTP (from m2eclipse extras) resolves my issues.

尽管如此,我仍然对如何实现这个没有m2eclipse感兴趣,只是出于好奇:p

I'm still interested in how to achieve this without m2eclipse, though, just out of curiosity :p

从Eclipse Marketplace可以找到需要在Eclipse中使用Web项目的两个Maven插件。

The two Maven plugins needed to work with web projects in Eclipse are available from the Eclipse Marketplace.

Maven Integration for Eclipse

Maven Integration for Eclipse (included in the Java version of Eclipse)

Eclipse WTP的Maven集成