/* Ċ Ġ* ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . Ġand Ġother Ġcontributors . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ Ġ*/ Ċ Ċ package Ġcom . jetbrains . plugin . structure . ide Ċ Ċ import Ġcom . intellij . openapi . util . io . File Util Ċ import Ġcom . intellij . util . System Properties Ċ import Ġcom . jetbrains . plugin . structure . base . utils . is Jar Ċ import Ġorg . jetbrains . j ps . model . J ps Element Factory Ċ import Ġorg . jetbrains . j ps . model . J ps Project Ċ import Ġorg . jetbrains . j ps . model . java . J ps Java Extension Service Ċ import Ġorg . jetbrains . j ps . model . library . J ps Order Root Type Ċ import Ġorg . jetbrains . j ps . model . serialization . J ps Project Loader Ċ import Ġjava . io . File Ċ import Ġjava . nio . file . Path Ċ import Ġjava . nio . file . Paths Ċ Ċ fun Ġget Repository Libraries J ars ( project Path : ĠPath ): ĠList < Path > Ġ{ ĊĠ Ġval Ġpath Variables Ġ= Ġcreate Path Variables () ĊĠ Ġval Ġproject Ġ= Ġload Project ( project Path , Ġpath Variables ) ĊĠ Ġreturn ĠJ ps Java Extension Service . dependencies ( project ) ĊĠĠĠ Ġ. production Only () ĊĠĠĠ Ġ. runtime Only () ĊĠĠĠ Ġ. libraries ĊĠĠĠ Ġ. flatMap Ġ{ Ġit . get Files ( J ps Order Root Type . COMPI LED ) Ġ} ĊĠĠĠ Ġ. map Ġ{ Ġit . to Path () Ġ} ĊĠĠĠ Ġ. distinct By Ġ{ Ġit . toString () Ġ} ĊĠĠĠ Ġ. filter Ġ{ Ġit . is Jar () Ġ} Ċ } Ċ Ċ private Ġfun Ġload Project ( project Path : ĠPath , Ġpath Variables : ĠMap < String , ĠString >): ĠJ ps Project Ġ{ ĊĠ Ġ// It Ġmust Ġbe Ġset Ġto Ġavoid Ġinitialization Ġexceptions Ġfrom Ġcom . intellij . openapi . application . Path Manager . get Home Path () ĊĠ ĠSystem . setProperty (" idea . home . path ", Ġproject Path . to AbsolutePath (). toString ()) ĊĊĠ Ġval Ġmodel Ġ= ĠJ ps Element Factory . getInstance (). create Model () ĊĠ ĠJ ps Project Loader . load Project ( model . project , Ġpath Variables , Ġproject Path . to AbsolutePath (). toString ()) ĊĠ Ġreturn Ġmodel . project Ċ } Ċ Ċ private Ġfun Ġcreate Path Variables (): ĠMap < String , ĠString > Ġ{ ĊĠ Ġval Ġmaven Repo File Ġ= ĠSystem . getProperty (" MA VEN _ REPOSITORY ") ?. let Ġ{ ĠPaths . get ( it ) Ġ} ĊĠĠĠ Ġ?: ĠPaths . get ( System Properties . getUser Home ()). resolve (". m 2 "). resolve (" repository ") ĊĠ Ġval Ġm 2 Repo Ġ= ĠFile Util . to System In dependent Name ( maven Repo File . to AbsolutePath (). toString ()) ĊĠ Ġreturn Ġmap Of (" MA VEN _ REPOSITORY " Ġto Ġm 2 Repo ) Ċ }