def ensure_jar()

in src/advisor/helpers/java/java_tool_invoker.py [0:0]


    def ensure_jar(self):
        """Makes sure JAR file exists, otherwise, it creates it
        
        Return:
            bool: True if it exists or it generated successfully
                False otherwise"""
        try:
            if path.isfile(self.JAR_PATH):
                return True
            
            if (Utils.running_from_binary()):
                return False
            
            pom_path = path.abspath(path.join(path.dirname(__file__), '..', '..', 'tools', 'graviton-ready-java', 'pom.xml'))
            logging.debug(f'POM file: {pom_path}')
            mvn_process = subprocess.run(f'mvn package --file {pom_path}', capture_output=True, shell=True)
            if (mvn_process.returncode == 0):
                return True
            
            return False

        except:
            logging.error('Error checking for Graviton Ready JAR file.', exc_info=True)
            return False