code: def package_maven():
      
      if not os.getenv('JAVA_HOME'):
          # make sure Maven uses the same JDK which we have used to compile
          # and link the C-code
          os.environ['JAVA_HOME'] = jdk_home_dir
  
      mvn_goal = 'package'
      log.info("Executing Maven goal '" + mvn_goal + "'")
      code = subprocess.call(['mvn', 'clean', mvn_goal, '-DskipTests'],
                             shell=platform.system() == 'Windows')
      if code:
          exit(code)
  
      #
      # Copy JAR results to lib/*.jar
      #
  
      if not os.path.exists(lib_dir):
          os.mkdir(lib_dir)
      target_dir = os.path.join(base_dir, 'target')
      jar_files = glob.glob(os.path.join(target_dir, '*.jar'))
      jar_files = [f for f in jar_files
                   if not (f.endswith('-sources.jar')
                           or f.endswith('-javadoc.jar'))]
      if not jar_files:
          log.error('Maven did not generate any JAR artifacts')
          exit(1)
      for jar_file in jar_files:
          build_dir = _build_dir()
          log.info("Copying " + jar_file + " -> " + build_dir + "")
          shutil.copy(jar_file, build_dir)
docs: Run maven package lifecycle