IntelliJ IDEA Tips

Time:2020-1-14

Generate annotations

  • Idea automatically generates method comments (including parameters and return values)

Walker’s settings in the community edition of IntelliJ idea 2019.2 are as follows
Template text

**
 * $VAR1$
$params$ * @return $returns$
 * @author: walker
 * @time: $date$ $time$
 * @description: 
 */ 

Groovy script

groovyScript("
    def result='';  
    def params=\"${_1}\".replaceAll('[\\[|\\]|\\s]', '').split(',').toList();   
    for(i = 0; i < params.size(); i++) {       
        if(i!=0)result+= ' * ';        
        result+='@param ' + params[i] + ((i < (params.size() - 1)) ? '\n' : '');   
    };    
    return result", methodParameters())

Maven add local jar package

Add to local warehouse

Take adding 4mc 2.1.0 as an example
Enter bin directory, Walker’s path is

C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.2\plugins\maven\lib\maven3\bin

Enter CMD to execute command

#Multiple lines for easy viewing
mvn install:install-file 
-Dpackaging=jar 
-DgroupId=com.hadoop.fourmc 
-DartifactId=hadoop-4mc 
-Dversion=2.1.0 
-Dfile="D:\project\lib\hadoop-4mc-2.1.0.jar"

Pom.xml add dependency

<dependency>
    <groupId>com.hadoop.fourmc</groupId>
    <artifactId>hadoop-4mc</artifactId>
    <version>2.1.0</version>
    <scope>compile</scope>
</dependency>

This article is from Walker snapshot