Linux平台下的Intellij IDEA基本设置

来源:互联网 发布:淘宝一千零一夜报名 编辑:程序博客网 时间:2024/05/17 08:01

Linux平台下的Intellij IDEA基本设置


1、添加桌面快捷方式
    [root@hadron 桌面]# touch ideaIU.desktop
    [root@hadron 桌面]# vi ideaIU.desktop
    #!/usr/bin/env xdg-open
    [Desktop Entry]
    Encoding=UTF-8
    Name=IdeaIU
    Comment=IdeaIU
    Exec=/root/idea-IU-163.10154.41/bin/idea.sh
    Icon=/root/idea-IU-163.10154.41/bin/idea.png
    Terminal=false
    StartupNotify=true
    Type=Application
    Categories=Application;Development;
       (补充:/usr/share/applications目录下的文件可以复制到桌面,即是桌面快捷方式)

2、设置JDK
    File -> Project Structure... -> Project
    设置到JDK根目录

3、设置Tomcat
    (1)Run主菜单 -> Edit Configurations...
    (2)展开Defaults,找到Tomcat Server下的Local
    (3)单击Application Server后的Configure...按钮,在Tomcat Home中输入Tomcat的根目录即可。
    (4)选中项目,单击右上角 Edit Configurations...,单击“+”号,选择Tomcat Server
         在上端Name处输入Tomcat8.5,server分页多了多了一个JMX端口1099,
         单击Deployment分页,在该分页下单击右侧“+”号,选择Artifact
    (5)IntelliJ IDEA 没有导入 servlet-api.jar 这个架包,需要你手动导入支持。
           1)选中项目,点击右键,选择open modual settings(或者直接按F4);
           2)在弹出的窗口左端选择Libraries,然后点击顶端的一个类似加号“+”的图标;
          3)在下拉框中选择Java,在弹出的窗口中选择tomcat所在的lib目录,选中servlet-api.jar,单击OK按钮
          4)在项目下面的External Libraries即可看到刚添加的jar包

4、IntelliJ IDEA将项目导出为war包
4.1 File -> Project Structure  ->  Artifacts
       Name输入项目名称,    Type选择Web Application:Archive
       Output directory:设置war包输入的目录
       Output Layout:

4.2    IntelliJ IDEA将项目导出为war包:
         Build主菜单 -> Build Artifacts
         -> 快捷菜单  -> **:war -> build/rebuild

5、IntelliJ IDEA快捷键
    1) Ctrl+Alt+O,优化导入的类和包
    2) Ctrl+Alt+L,格式化代码
    3) Ctrl+Enter,导入包,自动修正
    4) Ctrl+Shift+Space,自动补全代码
    5) Ctrl+X,删除行
    6) Ctrl+D,复制行
    7) Alt+Insert,可以生成构造器/Getter/Setter等

6、 Inotify Watches Limit

对于一个智能的IDE,关键是要知道它正在处理的文件中的任何外部变化。VCS做出的更改,或构建工具或代码生成器等。因此,IntelliJ平台旋转后台进程以监视此类更改。它使用的方法是平台特定的,在Linux上,它是Inotify工具。

Inotify需要为项目中的每个目录设置“watch handle”。 不幸的是,watch handle的默认限制可能不够用于合理规模的项目,并且达到极限将迫使IntelliJ平台回退到目录树的递归扫描。

 为了防止这种情况,建议增加手表限制(例如512K):

[root@hadron~]#echo "fs.inotify.max_user_watches = 524288" >>  /etc/sysctl.conf

[root@hadron ~]# sysctl -p --system
* Applying /usr/lib/sysctl.d/00-system.conf ...
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /usr/lib/sysctl.d/60-libvirtd.conf ...
fs.aio-max-nr = 1048576
* Applying /etc/sysctl.d/99-sysctl.conf ...
fs.inotify.max_user_watches = 524288
* Applying /etc/sysctl.conf ...
fs.inotify.max_user_watches = 524288



0 0
原创粉丝点击