add intellij
parent
981bb013b6
commit
829bc17bcb
|
@ -0,0 +1,8 @@
|
|||
不小心把Intellij中的xxx.iml文件删除了。启动项目的时候,项目没法正常打开,报出如下异常:
|
||||
|
||||
```
|
||||
Cannot load module file xxx.iml
|
||||
```
|
||||
|
||||
解决办法:
|
||||
将项目中的.idea文件夹删除,关闭Intellij,然后重新启动即可。
|
|
@ -0,0 +1,17 @@
|
|||
IntelliJ强大之处在于各种各式的丰富插件,能满足日常开发中的绝大部分需求。由于天朝众所周知的原因,通过Intellij在线安装插件的形式,经常会折腾很久安装不成功。最让人恼火的是一个几十M甚至只有几M的插件,经常安装到一半或者一部分以后,因为网络连接的原因安装失败。本博主印象中每次新装环境时,装python插件用在线安装的方式都花费了相当长时间。于是痛下决心,研究了一下离线安装的方式,发现好简单,并且效率也大大提高了。
|
||||
|
||||
## 1.将需要的插件下载到本地
|
||||
既然是手动离线安装,第一步自然是将需要的插件下载到本地。唯一需要注意的是注意插件的版本号与Intellij的版本号保持一致,以避免后续不必要的麻烦。例如我们想要安装python或者scala插件,在Preferences->Plugins里搜索python或者scala关键字,会显示出相应的插件。
|
||||
|
||||
![这里写图片描述](https://github.com/bitcarmanlee/easy-algorithm-interview-photo/blob/master/tools/intellij/4.png)
|
||||
|
||||
因为我这里python插件已经安装好了,所以显示的是Uninstall按钮。如果是未安装,显示的将会是绿色的Install按钮。
|
||||
|
||||
如果天朝没有GFW的话,我们直接Install就完事了。但是,你懂的,事情没这么简单,如果你尝试Install十次之内安装成功,那恭喜你,网络超给力。如果不能,那先根据右边插件提供的地址,去官网先下载过来到本地,这样最大的好吃是,支持断点续传,可以保证下载成功。
|
||||
|
||||
## 2.从本地安装
|
||||
下载完成以后,再打开Pluigin选项卡。
|
||||
|
||||
![这里写图片描述](https://github.com/bitcarmanlee/easy-algorithm-interview-photo/blob/master/tools/intellij/5.png)
|
||||
|
||||
注意此时右下角有个Install plugin from disk。点击进去,找到我们刚刚下载成功的插件所在的位置,选中zip压缩包然后点击open,再重启Intellij,OK,大功告成!
|
|
@ -0,0 +1,10 @@
|
|||
## 1.Override is not allowed when implementing interface method
|
||||
这是由于module的language level是6以下,我们需要修改module的language的level为6或6以上:
|
||||
|
||||
File->Project Structure->Project Settings -> Modules -> 选择所在的module -> 修改Language level为6或6以上 。修改设置完成以后,最好重启项目。
|
||||
|
||||
## 2.Error:java: Compilation failed: internal java compiler error
|
||||
很明显这个问题是由jdk的版本不一致引起的。
|
||||
![这里写图片描述](https://github.com/bitcarmanlee/easy-algorithm-interview-photo/blob/master/tools/intellij/1.png)
|
||||
|
||||
按图所示的位置设置Project bytecode version即可。
|
|
@ -0,0 +1,9 @@
|
|||
在IDE中写代码时,很多时候需要用到多行编辑模式。像我写java或者scala等jvm代码使用的是intellij,而写python代码一般使用的是pycharm,这两IDE都是JetBrains系列的IDE。
|
||||
JetBrains系列IDE里,多行编辑模式很简单,在文件中邮件,然后选择Column Select Mode,就可以进行多行编辑了。
|
||||
![在这里插入图片描述](https://github.com/bitcarmanlee/easy-algorithm-interview-photo/blob/master/tools/intellij/2.png)
|
||||
|
||||
Intellij里面的多行编辑效果图
|
||||
|
||||
![在这里插入图片描述](https://github.com/bitcarmanlee/easy-algorithm-interview-photo/blob/master/tools/intellij/3.png)
|
||||
|
||||
pycharm里面的多行编辑效果图
|
|
@ -0,0 +1,22 @@
|
|||
## 1.问题描述
|
||||
intellij运行java代码时,提示如下问题
|
||||
|
||||
```
|
||||
objc[xxx]: Class JavaLaunchHelper is implemented in both xxx and xxx. One of the two will be used. Which one is undefined.
|
||||
```
|
||||
|
||||
## 2.问题解决
|
||||
问题描述得比较清楚了,是系统中现在有两个JDK,intellij不知道选择哪个。所以重新配置一下就好
|
||||
|
||||
### 2.1 打开idea.properties文件
|
||||
点击help -> edit custom properties。如果系统中没有该文件,IDE会提示你是否创建该文件。
|
||||
|
||||
### 2.2 修改文件
|
||||
在文件后面添加一行
|
||||
|
||||
```
|
||||
idea.no.launcher=true
|
||||
```
|
||||
|
||||
## 2.3 重启IDE
|
||||
重启IDE即可。
|
|
@ -0,0 +1,23 @@
|
|||
原来用的Intellij是2016版本,版本比较老了,IDE经常出现一些莫名奇妙的问题:
|
||||
|
||||
1.某些项目中依赖的jar包,调用jar中的某些类,点进去发现是.class文件,而不是.java或者.scala文件,但是明明对应的source已经本地下载好。而且某些地方的引用IDE还有红色的部分提示报错,但是实际上能编译通过,说明此时代码其实没有问题,是IDE哪里出了问题。
|
||||
|
||||
2.用Spring Boot开发某些项目时候,用JPA去写对应的SQL语句时候,发现@QUERY中拼写的时候,IDE提示对应的POJO类找不到,但是实际上能正常运行,很明显又是IDE哪些犯傻了。
|
||||
|
||||
3.XML解析的时候经常各种莫名奇怪。不提了。。。
|
||||
|
||||
以上问题花了一些时间想去定位解决,最后都没搞定。。。
|
||||
偶尔跟同事聊起这些坑,他提到也遇到过类似的问题,说有可能是IDE版本太老,而我们现在用的框架比较新造成的。想了想,是有这种可能啊。
|
||||
|
||||
果断下载新版的Intellij 2018...
|
||||
|
||||
开始时候比较脑残,看到Intellij有-has-no-jdk版本。本着节约的原则,下了个no-jdk的版本。
|
||||
|
||||
结果悲剧了,发现无法启动idea.sh脚本,各种报错误。到idea.sh的脚本瞅了瞅,估计十有八九是jdk相关的配置问题。。。
|
||||
|
||||
时间紧迫,不想再这么耗着了,又下了个正常的版本。。。
|
||||
|
||||
启动,运行,会自动将老版本的相关配置导入到新版本的Intellij中。。。
|
||||
上面提到的那些问题统统解决。。。
|
||||
|
||||
所以,工具还是需要经常更新一下。。。太老的东西,容易出各种莫名其妙的问题。。。
|
|
@ -0,0 +1,22 @@
|
|||
在.vimrc中添加以下代码后,重启vim即可实现按TAB产生4个空格:
|
||||
set ts=4 (注:ts是tabstop的缩写,设TAB宽4个空格)
|
||||
set expandtab
|
||||
|
||||
|
||||
|
||||
对于已保存的文件,可以使用下面的方法进行空格和TAB的替换:
|
||||
TAB替换为空格:
|
||||
:set ts=4
|
||||
:set expandtab
|
||||
:%retab!
|
||||
|
||||
|
||||
|
||||
空格替换为TAB:
|
||||
:set ts=4
|
||||
:set noexpandtab
|
||||
:%retab!
|
||||
|
||||
|
||||
|
||||
加!是用于处理非空白字符之后的TAB,即所有的TAB,若不加!,则只处理行首的TAB。
|
|
@ -0,0 +1,35 @@
|
|||
## vim 查找相同的两行
|
||||
思路:先将两行排序,然后查找前一行等于后一行的内容
|
||||
|
||||
```
|
||||
:sort
|
||||
/^\(.\+\)$\n\1
|
||||
```
|
||||
|
||||
`^\(.\+\)$\n`表示一整行的模式,`\1`表示第一个组
|
||||
|
||||
## vim删除相同的行
|
||||
给出vim wiki上的两种解法,链接如下:
|
||||
http://vim.wikia.com/wiki/Uniq_-_Removing_duplicate_lines
|
||||
|
||||
There are two versions (and \v "verymagic" version as a variant of the second): the first leaves only the last line, the second leaves only the first line. (Use \zs for speed reason.)
|
||||
|
||||
|
||||
```
|
||||
g/^\(.*\)\n\1$/d
|
||||
g/\%(^\1\n\)\@<=\(.*\)$/d
|
||||
g/\v%(^\1\n)@<=(.*)$/d
|
||||
```
|
||||
|
||||
Breakdown of the second version:
|
||||
|
||||
```
|
||||
g/\%(^\1\n\)\@<=\(.*\)$/d
|
||||
g/ /d <-- Delete the lines matching the regexp
|
||||
\@<= <-- If the bit following matches, make sure the bit preceding this symbol directly precedes the match
|
||||
\(.*\)$ <-- Match the line into subst register 1
|
||||
\%( \) <-- Group without placing in a subst register.
|
||||
^\1\n <-- Match subst register 1 followed the new line between the 2 lines
|
||||
```
|
||||
|
||||
具体就不解释了,自行看解释(其实主要是我自己也没看太明白,哈哈)
|
Loading…
Reference in New Issue