Wednesday, 17 March 2021

intellij

 1. java/groovy

  • file -> project structure -> project: select sdk
  • file -> project structure -> modules: dependencies -> scope (compile: required to build, test, and run a project (the default scope).)
  • maven: intellij has its own maven, if using command line maven, need to configure it it intellij -> preferences -> search 'maven' -> maven home path -> select command line maven
  • 'maven' tab on right hand side of UI, under lifecycle,  has clean/validate/.. etc
  • after performing a lifecycle say install, need to click 'refresh' icon or popup, sometimes it's out-of-sync and not showing 'dependencies' that's downloaded
  • settings.xml: can be company customised

2. debug
  • drop frame: step过头,跳回上一级函数,重新再来

3. read code
  • navigate -> call hierarchy

4. auto generate code
  • right click -> generate              //constructor, getter & setter (after define the variable)
  • shift + command + T                //generate or update unit test

5. debug multi thread 
  • suspend policy 'thread'                                          //link 3
  • selective debugging by thread name                     //link 4
  • 'monitor' status: blocked, waiting on a lock
  • show 'monitor' status when deadlock happens     //link 6

6. reload all maven project button very important
  • it's the refresh button in maven view

 
reference

spock and groovy

 

1. spock configuration

  • SpockConfig.groovy


2. define annotation in groovy file

@Target([ElementType.TYPE, ElementType.METHOD])

@Retention(RetentionPolicy.RUNTIME)

@interface myTag {

}


reference

1. spock include/exclude specification based on annotation