Maven,如何从其他工件访问类
我制作了 3 个神器 常见的 配置 和完整 在我的完整 pom 中,我有:
<dependency>
<groupId>fr</groupId>
<artifactId>Common</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>fr</groupId>
<artifactId>pConfig</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
在我的完整工件代码源中,我尝试访问 Config 类,但它不起作用。 Maven 安装有效,但我在 Eclipse 中遇到错误: 导入 fr.datacontrol.DataSources;我有:导入无法解决... 你有什么想法吗? 谢谢
I made 3 artifacts
Common
Config
and Full
in my Full pom I had:
<dependency>
<groupId>fr</groupId>
<artifactId>Common</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>fr</groupId>
<artifactId>pConfig</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
And in my Full artifact code source I tried to access to Config class and It didn't work. Maven install works but I had an Error in Eclipse:
import fr.datacontrol.DataSources; I has: the import cannot be resolved...
Do you have an Idea?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它在 Maven 中工作但在 Eclipse 中不起作用,则意味着您在 Eclipse 中没有与 Maven 中相同的构建路径。这可能意味着 Eclipse 在构建项目时没有使用 POM 中的信息。
您可能需要在 Eclipse 中安装 m2e 插件 - 尽管我认为它是从 Indigo 开始默认包含的。
或者您可能只需要告诉 Eclipse 这是一个 Maven 项目:右键单击项目 ->配置->转换为 Maven 项目(在 Indigo 中)
If it's working in Maven but not in Eclipse, that means you don't have the same build path in Eclipse that you have in Maven. Which probably means that Eclipse isn't using the information in the POM when it builds your project.
You might need to install the m2e plugin in Eclipse - though I think it's included by default from Indigo onwards.
Or you might simply need to tell Eclipse that it's a Maven project: right-click on project -> Configure -> Convert to Maven project (in Indigo)