Eclipse 和 Maven 配置

发布于 2025-01-08 12:18:42 字数 206 浏览 2 评论 0原文

我是 Maven 的新手。我刚刚安装并配置了它。 当我开始编码时,我意识到 Eclipse 不会显示错误消息。 我通过谷歌搜索没有找到任何有用的东西。有些消息来源说将 java 构建器添加到您的项目中,但我已经这样做了。

这是屏幕截图

I'm new to Maven. I've just installed and configured it.
When I started coding, I realized Eclipse doesn't show the error messages.
I haven't found anything helpful by searching Google. Some sources say to add java builder to your project but I already did.

Here's a screenshot.

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

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

发布评论

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

评论(2

月光色 2025-01-15 12:18:42

看起来,您在 Eclipse 中的项目配置为在“src”子目录中包含源代码(并将类编译为“bin”)。
默认情况下,Maven 在 src/main/java 中查找 java 源(并将类编译为“target/classes”)。
因此,您需要将源代码移动到 src/main/java 或修改 pom.xml 以指向“src”作为源目录。
我建议遵循 Maven 约定并将源代码存储在 src/main/java 中。

It looks, that you had project in eclipse configured to have source code in 'src' subdirectory (and compile classes to 'bin').
Maven by default looks for java sources in src/main/java (and compile classes to 'target/classes').
So you'd need to move your source code to src/main/java or modify pom.xml to point to 'src' as source directory.
I'd suggest following maven convention and store source code in src/main/java.

假装不在乎 2025-01-15 12:18:42

您没有创建 Maven 标准文件夹结构。
创建这样的结构:
src/main/java 用于 Java 类,src/main/resources 用于属性等,然后右键单击该项目并选择 Maven ->更新项目配置。

You didn't create the Maven standard folder structure.
Create the structure like that:
src/main/java for Java classes and src/main/resources for properties etc., then do a right click on the project and choose Maven -> Update project configuration.

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