import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.FileUtils;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @ClassName JGitUtil
* @Description git命令操作工具
* @Version 1.0
**/
@Slf4j
@Component
public class JGitUtil {
/**
* @Description git clone操作
* @Param [url, localPath]
**/
public boolean cloneRepository(String url,String localPath)
{
File cloneFile = new File(localPath);
try{
log.info("git clone开始执行......");
Git repository = Git.cloneRepository().setURI(url).setBranch("master").setDirectory(cloneFile).call();
repository.getRepository().close();
log.info("git clone 执行完成......");
return true;
}catch(Exception e)
{
log.error("git clone 执行失败,请检查",e.getMessage());
e.printStackTrace();
return false;
}
}
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
import com.alibaba.fastjson.JSONObject;
import com.ljqc.license.entity.pg.SysAccountEntity;
import com.ljqc.license.service.ISysAccountService;
import com.ljqc.license.utils.AccountUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
impo