一、maven配置

1.1 settings.xml

配置阿里云的仓库,放到你的maven对应配置路径下。maven仓库地址:https://mvnrepository.com/
阿里云配置文档请参考:
https://developer.aliyun.com/mirror/maven

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  4. <!-- 本地仓库的位置 -->
  5. <localRepository>${user.home}/.m2/repository</localRepository>
  6. <!-- Apache Maven 配置 -->
  7. <pluginGroups/>
  8. <proxies/>
  9. <!-- 私服发布的用户名密码 -->
  10. <servers>
  11. <server>
  12. <id>releases</id>
  13. <username>deployment</username>
  14. <password>He2019</password>
  15. </server>
  16. <server>
  17. <id>snapshots</id>
  18. <username>deployment</username>
  19. <password>He2019</password>
  20. </server>
  21. </servers>
  22. <!-- 阿里云镜像 -->
  23. <mirrors>
  24. <mirror>
  25. <id>alimaven public</id>
  26. <name>aliyun maven public</name>
  27. <url>https://maven.aliyun.com/repository/public/</url>
  28. <mirrorOf>central</mirrorOf>
  29. </mirror>
  30. </mirrors>
  31. <!-- 配置: java8, 先从阿里云下载, 没有再去私服下载 -->
  32. <!-- 20190929 hepengju 测试结果: 影响下载顺序的是profiles标签的配置顺序(后面配置的ali仓库先下载), 而不是activeProfiles的顺序 -->
  33. <profiles>
  34. <!-- 全局JDK1.8配置 -->
  35. <profile>
  36. <id>jdk1.8</id>
  37. <activation>
  38. <activeByDefault>true</activeByDefault>
  39. <jdk>1.8</jdk>
  40. </activation>
  41. <properties>
  42. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  43. <maven.compiler.source>1.8</maven.compiler.source>
  44. <maven.compiler.target>1.8</maven.compiler.target>
  45. <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
  46. </properties>
  47. </profile>
  48. <!-- 阿里云配置: 提高国内的jar包下载速度 -->
  49. <profile>
  50. <id>ali</id>
  51. <!--仓库镜像-->
  52. <repositories>
  53. <repository>
  54. <id>public</id>
  55. <url>http://maven.nuxeo.org/nexus/content/groups/public</url>
  56. <releases>
  57. <enabled>true</enabled>
  58. </releases>
  59. <snapshots>
  60. <enabled>false</enabled>
  61. </snapshots>
  62. </repository>
  63. <repository>
  64. <id>public-snapshot</id>
  65. <url>
  66. http://maven.nuxeo.org/nexus/content/groups/public-snapshot
  67. </url>
  68. <releases>
  69. <enabled>false</enabled>
  70. </releases>
  71. <snapshots>
  72. <updatePolicy>always</updatePolicy>
  73. <enabled>true</enabled>
  74. </snapshots>
  75. </repository>
  76. <repository>
  77. <id>public</id>
  78. <name>aliyun nexus</name>
  79. <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  80. <releases>
  81. <enabled>true</enabled>
  82. </releases>
  83. </repository>
  84. </repositories>
  85. <pluginRepositories>
  86. <pluginRepository>
  87. <id>public</id>
  88. <url>http://maven.nuxeo.org/nexus/content/groups/public</url>
  89. <name>Nuxeo virtual release repository</name>
  90. <releases>
  91. <enabled>true</enabled>
  92. </releases>
  93. <snapshots>
  94. <enabled>false</enabled>
  95. </snapshots>
  96. </pluginRepository>
  97. <pluginRepository>
  98. <id>public-snapshot</id>
  99. <url>
  100. http://maven.nuxeo.org/nexus/content/groups/public-snapshot
  101. </url>
  102. <name>Nuxeo virtual snapshot repository</name>
  103. <releases>
  104. <enabled>false</enabled>
  105. </releases>
  106. <snapshots>
  107. <updatePolicy>always</updatePolicy>
  108. <enabled>true</enabled>
  109. </snapshots>
  110. </pluginRepository>
  111. <pluginRepository>
  112. <id>public</id>
  113. <name>aliyun nexus</name>
  114. <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  115. <releases>
  116. <enabled>true</enabled>
  117. </releases>
  118. <snapshots>
  119. <enabled>false</enabled>
  120. </snapshots>
  121. </pluginRepository>
  122. </pluginRepositories>
  123. </profile>
  124. </profiles>
  125. <!-- 激活配置 -->
  126. <activeProfiles>
  127. <activeProfile>jdk1.8</activeProfile>
  128. <activeProfile>dev</activeProfile>
  129. <activeProfile>ali</activeProfile>
  130. </activeProfiles>
  131. </settings>

二、注释快捷

2.1 添加模板

打开preferences菜单(有些版本是settings),找到Live Templates设置,”2. Template Group…”创建组,如我这里创建了kang。”1 Live Temlate”创建组下面的模板,如我这里创建了a和c。image.png
Abbreviation设置就是快捷键,如我这里设置a为快捷键。
image.png
Temlate Text内容如下
a 方法注释模板:

  1. **
  2. $param$
  3. * @description: 方法定义
  4. * @return: $return$
  5. * @author: kangzeng.ckz
  6. * @date: $date$
  7. */

c 类注释模板:

  1. **
  2. * @className: $NAME$
  3. * @description: $NAME$ 描述
  4. * @author: kangzeng.ckz
  5. * @date: $DATE$
  6. **/

点击”Edit Variables”按钮,打开上面设置的变量对应函数功能设置
image.png
变量和方法对应

  • date → date()
  • time → time()
  • author → user()
  • return → methodReturnType()
  • params 的值(即 groovyScript 函数)
    1. groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {result+=' * @param ' + params[i] + ((i < params.size() - 1) ? '\\n' : '')}; return result", methodParameters())

2.2 生效范围

这里我们设置了java工程下生效
image.png

三、快捷键修改

参考
https://blog.csdn.net/xinghuo0007/article/details/78441574

四、常用插件

开发常用插件。

  • free mybatis plugin
  • lombok
  • better-mybatis-generator
  • alibaba java coding guidelines
  • maven

    4.1 better-mybatis-generator

这是mybatis的一个插件。
image.png
在idea工程的database设置数据库链接,阿里云的rds需要加上serverTimezone=GMT参数。
image.png
链接好数据库后,右键点击表,选择弹出的mybatis-generator生成文件。
image.png

better-mybatis-generator设置参考
image.png

[

](https://blog.csdn.net/sowei2009/article/details/108687274)