// ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġorg . jetbrains . idea . maven . execution . target Ċ Ċ import Ġcom . intellij . execution . C ant Run Exception Ċ import Ġcom . intellij . execution . configurations . Parameters List Ċ import Ġcom . intellij . execution . target .* Ċ import Ġcom . intellij . execution . target . Language Runtime Type . Volume Descriptor Ċ import Ġcom . intellij . execution . target . java . Java Language Runtime Configuration Ċ import Ġcom . intellij . execution . target . value . Deferred Target Value Ċ import Ġcom . intellij . execution . target . value . Target Value Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . roots . Project File Index Ċ import Ġcom . intellij . openapi . util . Key Ċ import Ġcom . intellij . openapi . util . N ls Safe Ċ import Ġcom . intellij . openapi . util . io . File Util .* Ċ import Ġcom . intellij . openapi . util . text . StringUtil Ċ import Ġcom . intellij . openapi . vfs . V fs Util Ċ import Ġcom . intellij . util . text . nul lize Ċ import Ġorg . jetbrains . concurrency . Async Promise Ċ import Ġorg . jetbrains . concurrency . Promise Ċ import Ġorg . jetbrains . idea . maven . execution . Maven Execution Options Ċ import Ġorg . jetbrains . idea . maven . execution . Maven External Parameters . MA VEN _ OPTS Ċ import Ġorg . jetbrains . idea . maven . execution . Maven External Parameters . encode Profiles Ċ import Ġorg . jetbrains . idea . maven . execution . Maven Run Configuration Ċ import Ġorg . jetbrains . idea . maven . execution . Maven Runner Ċ import Ġorg . jetbrains . idea . maven . execution . Maven Runner Settings Ċ import Ġorg . jetbrains . idea . maven . execution . Runner Bundle . message Ċ import Ġorg . jetbrains . idea . maven . model . Maven Constants Ċ import Ġorg . jetbrains . idea . maven . project . Maven General Settings Ċ import Ġorg . jetbrains . idea . maven . project . Maven Project Ċ import Ġorg . jetbrains . idea . maven . project . Maven Projects Manager Ċ import Ġorg . jetbrains . idea . maven . server . Maven Server Embed der Ċ import Ġorg . jetbrains . idea . maven . server . Maven Server Manager Ċ import Ġorg . jetbrains . idea . maven . utils . Maven Util Ċ import Ġjava . io . File Ċ import Ġjava . nio . file . Path Ċ import Ġjava . nio . file . Paths Ċ import Ġjava . util .* Ċ Ċ class ĠMaven CommandLine Setup ( private Ġval Ġproject : ĠProject , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġname : Ġ@ N ls Safe ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġrequest : ĠTarget Environment Request , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġtarget : ĠTarget Environment Configuration ) Ġ{ ĊĊĠ Ġval Ġcommand Line Ġ= ĠTarget ed CommandLine Builder ( request ) ĊĠ Ġval Ġplatform Ġ= Ġrequest . target Platform . platform ĊĊĠ Ġprivate Ġval Ġdefault Maven Runtime Configuration : ĠMaven Runtime Target Configuration ? Ġ= Ġtarget . runtime s . findBy Type ( ĊĠĠĠ ĠMaven Runtime Target Configuration :: class . java ) ĊĠ Ġprivate Ġval Ġdefault Java Runtime Configuration : ĠJava Language Runtime Configuration ? Ġ= Ġtarget . runtime s . findBy Type ( ĊĠĠĠ ĠJava Language Runtime Configuration :: class . java ) ĊĊĠ Ġprivate Ġval Ġenvironment Promise Ġ= ĠAsync Promise < Pair < Target Environment , ĠTarget Environment Aware Run Profile State . Target Progress Indicator >>() ĊĠ Ġprivate Ġval Ġdepending On Environment Promise Ġ= Ġmutable ListOf < Promise < Unit >>() ĊĊĠ Ġinit Ġ{ ĊĠĠĠ Ġcommand Line . put UserData ( setup Key , Ġthis ) ĊĠ Ġ} ĊĊĠ Ġ@ Throws ( C ant Run Exception :: class ) ĊĠ Ġfun Ġsetup CommandLine ( settings : ĠMaven Run Configuration . Maven Settings ): ĠMaven CommandLine Setup Ġ{ ĊĠĠĠ Ġval Ġmaven Opts Values Ġ= Ġmutable ListOf < Target Value < String >>() ĊĠĠĠ Ġsetup Exe Path ( settings . my General Settings ) ĊĠĠĠ Ġsetup Target Java Runtime ( settings . my Runner Settings ) ĊĠĠĠ Ġsetup Target Project Directories ( settings ) ĊĠĠĠ Ġsetup Maven Ext Class Path ( maven Opts Values ) ĊĠĠĠ Ġadd Maven Parameters ( settings , Ġmaven Opts Values ) ĊĠĠĠ Ġsetup Target Environment Variables ( settings , Ġmaven Opts Values ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġprovide Environment ( environment : ĠTarget Environment , Ġprogress Indicator : ĠTarget Environment Aware Run Profile State . Target Progress Indicator ) Ġ{ ĊĠĠĠ Ġenvironment Promise . set Result ( environment Ġto Ġprogress Indicator ) ĊĠĠĠ Ġfor Ġ( promise Ġin Ġdepending On Environment Promise ) Ġ{ ĊĠĠĠĠĠ Ġpromise . blocking Get ( 0 ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Throws ( C ant Run Exception :: class ) ĊĠ Ġprivate Ġfun Ġsetup Exe Path ( general Settings : ĠMaven General Settings ) Ġ{ ĊĠĠĠ Ġif Ġ( default Maven Runtime Configuration Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . set Exe Path (" mvn ") ĊĠĠĠĠĠ Ġreturn ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġhome Path : ĠString ĊĠĠĠ Ġif Ġ( general Settings . maven Home Ġ== ĠMaven Server Manager . B UND LED _ MA VEN _ 3 ) Ġ{ ĊĠĠĠĠĠ Ġhome Path Ġ= Ġdefault Maven Runtime Configuration . home Path ĊĠĠĠ Ġ} ĊĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠ Ġhome Path Ġ= Ġgeneral Settings . maven Home ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġif Ġ( StringUtil . isEmpty Or Spaces ( home Path )) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . set Exe Path (" mvn ") ĊĠĠĠĠĠ Ġreturn ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcommand Line . add EnvironmentVariable (" MA VEN _ HOME ", Ġhome Path ) ĊĠĠĠ Ġcommand Line . set Exe Path ( join Path ( array Of ( home Path , Ġ" bin ", Ġ" mvn "))) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsetup Target Java Runtime ( runner Settings : ĠMaven Runner Settings ) Ġ{ ĊĠĠĠ Ġwhen Ġ{ ĊĠĠĠĠĠ Ġrunner Settings . jre Name Ġ!= ĠMaven Runner Settings . USE _ PROJECT _ JDK Ġ-> Ġrunner Settings . jre Name ĊĠĠĠĠĠ Ġdefault Java Runtime Configuration ?. home Path ?. isNotBlank () Ġ== Ġtrue Ġ-> Ġdefault Java Runtime Configuration . home Path ĊĠĠĠĠĠ Ġelse Ġ-> Ġnull ĊĠĠĠ Ġ} ?. let Ġ{ Ġcommand Line . add EnvironmentVariable (" JAVA _ HOME ", Ġit ) Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsetup Maven Ext Class Path ( maven Opts Values : ĠMutable List < Target Value < String >>) Ġ{ ĊĠĠĠ Ġval Ġmaven EventListener Ġ= ĠMaven Server Manager . getM aven EventListener () ĊĠĠĠ Ġval Ġupload Path Ġ= ĠPaths . get ( to System Dependent Name ( maven EventListener . path )) ĊĠĠĠ Ġval Ġupload Root Ġ= Ġcreate Upload Root ( Maven Runtime Type . MA VEN _ EXT _ CLASS _ PATH _ VOLUME , Ġupload Path . parent ) ĊĠĠĠ Ġrequest . upload Volumes Ġ+= Ġupload Root ĊĠĠĠ Ġval Ġtarget Value Ġ= Ġupload ( upload Root , Ġupload Path . toString (), Ġupload Path . fileName . toString ()) ĊĠĠĠ Ġmaven Opts Values . add ( Target Value . map ( target Value ) Ġ{ Ġ"- D " Ġ+ ĠMaven Server Embed der . MA VEN _ EXT _ CLASS _ PATH Ġ+ Ġ"=" Ġ+ Ġit Ġ}) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġadd Maven Parameters ( settings : ĠMaven Run Configuration . Maven Settings , Ġmaven Opts Values : ĠMutable List < Target Value < String >>) Ġ{ ĊĠĠĠ Ġval Ġgeneral Settings : ĠMaven General Settings Ġ= Ġmaven General Settings ( settings ) ĊĠĠĠ Ġval Ġrunner Settings Ġ= Ġmaven Runner Settings ( settings ) ĊĠĠĠ Ġif Ġ( runner Settings . is Skip Tests ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ("- D skip Tests = true ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġmaven Opts Values . add ( Target Value . fixed ("- D idea . version =${ Maven Util . get Ide a Version To Pass To Maven Process ()} ")) ĊĠĠĠ Ġif Ġ( runner Settings . vm Options . isNotBlank ()) Ġ{ ĊĠĠĠĠĠ Ġmaven Opts Values . add ( Target Value . fixed ( runner Settings . vm Options )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġmaven Properties List Ġ= ĠParameters List () ĊĠĠĠ Ġrunner Settings . maven Properties ĊĠĠĠĠĠ Ġ. filter Keys Ġ{ Ġit . isNotEmpty () Ġ} ĊĠĠĠĠĠ Ġ. forEach Ġ{ Ġ( key , Ġvalue ) Ġ-> Ġmaven Properties List . addProperty ( key , Ġvalue ) Ġ} ĊĠĠĠ Ġcommand Line . add Parameters ( maven Properties List . parameters ) ĊĊĠĠĠ Ġval Ġrunner Parameters Ġ= Ġsettings . my Runner Parameters ĊĠĠĠ Ġfor Ġ( goal Ġin Ġrunner Parameters . goals ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ( goal ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ( runner Parameters . pom FileName Ġ!= Ġnull Ġ&& Ġ! names Equal ( Maven Constants . PO M _ XML , Ġrunner Parameters . pom FileName )) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ("- f ") ĊĠĠĠĠĠ Ġcommand Line . add Parameter ( runner Parameters . pom FileName ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġencode Profiles Ġ= Ġencode Profiles ( runner Parameters . profiles Map ) ĊĠĠĠ Ġif Ġ( encode Profiles . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameters ("- P ", Ġencode Profiles ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ( general Settings . is Work Offline ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ("-- offline ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ( general Settings . output Level Ġ== ĠMaven Execution Options . Logging Level . DEBUG ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ("-- debug ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ( general Settings . is Non Recursive ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ("-- non - recursive ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ( general Settings . is Print Error Stack Tr aces ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ("-- errors ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ( general Settings . is Always Update Snapshots ) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameter ("-- update - snapshots ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ(! general Settings . threads . isNull Or Blank ()) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameters ("- T ", Ġgeneral Settings . threads ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġgeneral Settings . failure Behavior . command Line Option . nul lize ( true )?. also Ġ{ Ġcommand Line . add Parameter ( it ) Ġ} ĊĠĠĠ Ġgeneral Settings . checksum Policy . command Line Option . nul lize ( true )?. also Ġ{ Ġcommand Line . add Parameter ( it ) Ġ} ĊĊĠĠĠ Ġif Ġ( general Settings . user Settings File . isNotBlank ()) Ġ{ ĊĠĠĠĠĠ Ġcommand Line . add Parameters ("- s ", Ġgeneral Settings . user Settings File ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġgeneral Settings . local Repository . nul lize ( true )?. also Ġ{ Ġcommand Line . add Parameter ("- D maven . repo . local =$ it ") Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsetup Target Environment Variables ( settings : ĠMaven Run Configuration . Maven Settings , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmaven Opts Values : ĠMutable List < Target Value < String >>) Ġ{ ĊĠĠĠ Ġval Ġrunner Settings Ġ= Ġmaven Runner Settings ( settings ) ĊĠĠĠ Ġrunner Settings . environment Properties . forEach Ġ{ Ġ( name , Ġvalue ) Ġ-> ĊĠĠĠĠĠ Ġif Ġ( MA VEN _ OPTS Ġ== Ġname ) Ġ{ ĊĠĠĠĠĠĠĠ Ġmaven Opts Values . add ( Target Value . fixed ( value )) ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġcommand Line . add EnvironmentVariable ( name , Ġvalue ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġtarget Value Ġ= ĠTarget Value . composite ( maven Opts Values ) Ġ{ Ġit . join ToString ( separator Ġ= Ġ" Ġ") Ġ} ĊĠĠĠ Ġcommand Line . add EnvironmentVariable ( MA VEN _ OPTS , Ġtarget Value ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġmaven General Settings ( settings : ĠMaven Run Configuration . Maven Settings ): ĠMaven General Settings Ġ{ ĊĠĠĠ Ġreturn Ġsettings . my General Settings Ġ?: ĠMaven Projects Manager . getInstance ( project ). general Settings ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġmaven Runner Settings ( settings : ĠMaven Run Configuration . Maven Settings ): ĠMaven Runner Settings Ġ{ ĊĠĠĠ Ġreturn Ġsettings . my Runner Settings Ġ?: ĠMaven Runner . getInstance ( project ). state ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġupload ( upload Root : ĠTarget Environment . Upload Root , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġupload Path String : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġupload RelativePath : ĠString ): ĠTarget Value < String > Ġ{ ĊĠĠĠ Ġval Ġresult Ġ= ĠDeferred Target Value ( upload Path String ) ĊĠĠĠ Ġdepending On Environment Promise Ġ+= Ġenvironment Promise . then Ġ{ Ġ( environment , Ġprogress ) Ġ-> ĊĠĠĠĠĠ Ġval Ġvolume Ġ= Ġenvironment . upload Volumes . getValue ( upload Root ) ĊĠĠĠĠĠ Ġresult . resolve ( volume . upload ( upload RelativePath , Ġprogress )) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġresult ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcreate Upload Root ( volume Descriptor : ĠVolume Descriptor , Ġlocal RootPath : ĠPath ): ĠTarget Environment . Upload Root Ġ{ ĊĠĠĠ Ġreturn ĠMaven Runtime Target Configuration . create Upload Root ( default Maven Runtime Configuration , Ġrequest , Ġtarget , Ġvolume Descriptor , Ġlocal RootPath ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsetup Target Project Directories ( settings : ĠMaven Run Configuration . Maven Settings ) Ġ{ ĊĠĠĠ Ġval Ġworking Directory Ġ= Ġsettings . my Runner Parameters . working Dir File ĊĊĠĠĠ Ġval Ġmaven Projects Manager Ġ= ĠMaven Projects Manager . getInstance ( project ) ĊĠĠĠ Ġval Ġfile Ġ= ĠV fs Util . find File By Io File ( working Directory , Ġfalse ) Ġ?: Ġthrow ĠC ant Run Exception ( ĊĠĠĠĠĠ Ġmessage (" maven . target . message . unable . to . use . working . directory ", Ġname )) ĊĠĠĠ Ġval Ġmodule Ġ= ĠProject File Index . getInstance ( project ). getModule For File ( file ) Ġ?: Ġthrow ĠC ant Run Exception ( ĊĠĠĠĠĠ Ġmessage (" maven . target . message . unable . to . find . maven . project . for . working . directory ", Ġname )) ĊĠĠĠ Ġval Ġmaven Project : ĠMaven Project Ġ= Ġmaven Projects Manager . find Project ( module ) Ġ?: Ġthrow ĠC ant Run Exception ( ĊĠĠĠĠĠ Ġmessage (" maven . target . message . unable . to . find . maven . project . for . working . directory ", Ġname )) ĊĊĠĠĠ Ġval Ġmaven Project Directory Ġ= Ġto System Dependent Name ( maven Project . directory ) ĊĠĠĠ Ġval Ġpaths To Upload Ġ= Ġfind Paths To Upload ( maven Projects Manager , Ġmaven Project ) ĊĠĠĠ Ġval Ġcommon Ancestor Ġ= Ġfind Common Ancestor ( paths To Upload ) ĊĠĠĠ Ġval Ġupload Path Ġ= ĠPaths . get ( to System Dependent Name ( common Ancestor !! )) ĊĠĠĠ Ġval Ġupload Root Ġ= Ġcreate Upload Root ( Maven Runtime Type . PROJECT _ FOLDER _ VOLUME , Ġupload Path ) ĊĠĠĠ Ġrequest . upload Volumes Ġ+= Ġupload Root ĊĠĠĠ Ġval Ġtarget File Separator Ġ= Ġrequest . target Platform . platform . file Separator ĊĊĠĠĠ Ġvar Ġtarget Working Directory : ĠTarget Value < String >? Ġ= Ġnull ĊĠĠĠ Ġfor Ġ( path Ġin Ġpaths To Upload ) Ġ{ ĊĠĠĠĠĠ Ġval Ġrelative Path Ġ= Ġget RelativePath ( common Ancestor , Ġpath , ĠFile . separator Char ) ĊĠĠĠĠĠ Ġval Ġtarget Value Ġ= Ġupload ( upload Root , Ġpath , Ġrelative Path !! ) ĊĠĠĠĠĠ Ġif Ġ( target Working Directory Ġ== Ġnull Ġ&& Ġis Ancestor ( path , Ġmaven Project Directory , Ġfalse )) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġworking Dir RelativePath Ġ= Ġget RelativePath ( path , Ġmaven Project Directory , ĠFile . separator Char ) !! ĊĠĠĠĠĠĠĠ Ġval Ġtarget Working Dir RelativePath Ġ= Ġif Ġ( working Dir RelativePath Ġ== Ġ". ") Ġ"" ĊĠĠĠĠĠĠĠ Ġelse Ġto System Dependent Name ( working Dir RelativePath , Ġtarget File Separator ) ĊĠĠĠĠĠĠĠ Ġtarget Working Directory Ġ= ĠTarget Value . map ( target Value ) Ġ{ Ġ"$ it $ target File Separator $ target Working Dir RelativePath " Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġcommand Line . set Working Directory ( target Working Directory !! ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġfind Common Ancestor ( paths : ĠSet < String >): ĠString ? Ġ{ ĊĠĠĠ Ġvar Ġcommon Root : ĠFile ? Ġ= Ġnull ĊĠĠĠ Ġfor Ġ( path Ġin Ġpaths ) Ġ{ ĊĠĠĠĠĠ Ġcommon Root Ġ= Ġif Ġ( common Root Ġ== Ġnull ) ĠFile ( path ) Ġelse Ġfind Ancestor ( common Root , ĠFile ( path )) ĊĠĠĠĠĠ Ġrequire NotNull ( common Root ) Ġ{ Ġ" no Ġcommon Ġroot Ġfound " Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġassert ( common Root Ġ!= Ġnull ) ĊĠĠĠ Ġreturn Ġcommon Root !!. path ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġfind Paths To Upload ( maven Projects Manager : ĠMaven Projects Manager , Ġproject : ĠMaven Project ): ĠSet < String > Ġ{ ĊĠĠĠ Ġval Ġroot Project Ġ= Ġmaven Projects Manager . find Root Project ( project ) Ġ?: Ġreturn Ġempty Set () ĊĠĠĠ Ġval Ġprojects Ġ= ĠLinkedList < Maven Project >() ĊĠĠĠ Ġprojects Ġ+= Ġroot Project ĊĠĠĠ Ġprojects . addAll ( findAll In her itors ( maven Projects Manager , Ġroot Project )) ĊĠĠĠ Ġval Ġpaths : ĠMutable Set < String > Ġ= ĠHashSet () ĊĠĠĠ Ġwhile Ġ( projects . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠ Ġval Ġmaven Project Ġ= Ġprojects . pop () ĊĠĠĠĠĠ Ġval Ġproject Directory Ġ= Ġto System Dependent Name ( maven Project !!. directory ) ĊĠĠĠĠĠ Ġif Ġ( paths . any Ġ{ Ġis Ancestor ( it , Ġproject Directory , Ġfalse ) Ġ}) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontinue ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġpaths . remove If Ġ{ Ġis Ancestor ( project Directory , Ġit , Ġfalse ) Ġ} ĊĠĠĠĠĠ Ġpaths . add ( project Directory ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġpaths ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠfindAll In her itors ( maven Projects Manager : ĠMaven Projects Manager , Ġproject : ĠMaven Project ): ĠList < Maven Project > Ġ{ ĊĠĠĠ Ġval Ġin her itors Ġ= Ġmaven Projects Manager . find In her itors ( project ) ĊĠĠĠ Ġval Ġresult Ġ= ĠArrayList ( in her itors ) ĊĠĠĠ Ġfor Ġ( in her itor Ġin Ġin her itors ) Ġ{ ĊĠĠĠĠĠ Ġresult Ġ+= ĠfindAll In her itors ( maven Projects Manager , Ġin her itor ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġresult ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġjoin Path ( segments : ĠArray < String >) Ġ= Ġsegments . join To ( StringBuilder (), Ġplatform . file Separator . toString ()). toString () ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġval Ġsetup Key Ġ= ĠKey . create < Maven CommandLine Setup >(" org . jetbrains . idea . maven . execution . target . Maven CommandLine Setup ") ĊĠ Ġ} Ċ }