在IntelliJ中创建新包 [英] Create new package in IntelliJ

查看:155
本文介绍了在IntelliJ中创建新包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从使用Eclipse转移到IntelliJ的勇敢新世界,我正试图解决那些让我失望的小事(小事)。



当你知道怎么做时,最新的很明显很明显。



我在源文件夹下创建了一个新包:

  uk.ac.cam.admin 

我右键单击这个新包来创建另一个子包:

  uk.ac.cam.admin .domain 

到目前为止一切顺利,现在我想创建一个的包服务处于同一级别。
但是从 uk.ac.cam.admin.domain 创建它会导致 uk.ac.cam.admin.domain。服务并在源上创建它只会产生服务



显然我可以从源代码创建一个新的包并输入完全限定的路径,但它是2013年,我很懒! ;)

解决方案

项目视图中禁用压缩空中间包选项





现在,您将看到 admin 作为一个单独的节点,并且可以在其中创建一个新包。 / p>

I've just moved from years of using Eclipse to the brave new world of IntelliJ and I'm trying to iron out the little (trivial) little things that are slowing me down.

The latest is hopefully painfully obvious when you know how to do it.

I create a new package under my source folder:

uk.ac.cam.admin

I right click on this new package to create another sub-package:

uk.ac.cam.admin.domain

All well so far, now I want to create a package of service at the same level as domain. However creating it from uk.ac.cam.admin.domain quite rightly results in uk.ac.cam.admin.domain.service and creating it on the source just results in service.

Obviously I can create a new package from the source and type the fully qualified path, but it's 2013 and I'm lazy! ;)

解决方案

Disable Compact Empty Middle Packages option in the Project View:

You will now see admin as a separate node and will be able to create a new package inside it.

这篇关于在IntelliJ中创建新包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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