将Maven项目导入IntelliJ 2019.3后,捆绑的类不在类路径中 [英] After importing a Maven project into IntelliJ 2019.3, the bundled classes are not on class path

查看:217
本文介绍了将Maven项目导入IntelliJ 2019.3后,捆绑的类不在类路径中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导入新创建的Vaadin 14.0.x项目并使用Import Project功能在IntelliJ 2019.3 EAP中创建Maven驱动的项目后,我收到一条消息,提示无法解析符号".该错误消息为我提供了一个将库…添加到类路径"按钮.但是必要的库已经由Maven作为依赖项加载.因此,这没有任何意义.

After importing a newly created Vaadin 14.0.x project, and using the Import Project feature to create a Maven-driven project in IntelliJ 2019.3 EAP, I get a message saying "Cannot resolving symbol". The error message offers me a button to "Add library … to classpath". But the necessary libraries are already loaded by Maven as dependencies. So this makes no sense.

我尝试了3次导入.每次尝试时,我都打开另一个项目来运行File> Invalidate Caches / Restart菜单项.此操作通过创建与已删除项目同名的新项目来避免已知的IntelliJ错误/反功能.

I retried the import 3 times. On each effort I opened another project to run the File > Invalidate Caches / Restart menu item. This action avoids known IntelliJ bugs/anti-features with creating a new project with same name as a deleted project.

的成功.

最终,我尝试使用欢迎使用IntelliJ IDEA"面板的Open功能.令人惊讶的是,没有这样的问题.所有类都可以由IntelliJ代码编辑器识别.

Eventually I tried using the Open feature of the "Welcome to IntelliJ IDEA` panel. Amazingly, no such problem. All the classes are recognized by the IntelliJ code editor.

Bizarre,每次我打开由 创建的原始项目的新解压缩副本时,从Vaadin 页开始.在IntelliJ中使用OpenImport Project之间有一些主要区别.

Bizarre, as I am opening each time a fresh unzipped copy of the original project created by the Getting Started with Vaadin page. There is some major difference between using Open versus Import Project in IntelliJ.

推荐答案

避免使用Create project from existing sources选项

我怀疑当您选择Import Project路由时,您接受了结果对话框中的默认选项. 不要使用该选项.

Avoid Create project from existing sources option

I suspect that when you chose the Import Project route, you accepted the default option in the resulting dialog box. Do not use that option.

根据您的情况,该选项Create project from existing sources将失败. 文档没有解释第一项.但是,选择似乎需要一个完整的项目文件夹.显然,您的不是.

That option, Create project from existing sources will fail in your situation. The documentation for that dialog unfortunately does not explain the first item. But option seems to expect a fully-formed project folder. Yours is not, apparently.

相反,选择第二个选项Import project from external model.对于您的情况,从列表中选择Maven来进行Vaadin 14项目.

Instead, choose the second option, Import project from external model. Select Maven from the list, in your case, for a Vaadin 14 project.

请注意,使用此选项,您将经历一系列对话框向导 -风格.而使用第一个选项,则直接打开了该项目.

Note that with this option, you go through a series of dialogs Wizard-style. Whereas, with the first option, you directly opened the project.

使用第二个选项并完成一系列对话框,将产生可操作的Vaadin 14项目.

Using this second option, and completing the series of dialogs, will yield an operational Vaadin 14 project.

这篇关于将Maven项目导入IntelliJ 2019.3后,捆绑的类不在类路径中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆