最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

批量將現(xiàn)有Jar包上傳到Maven私服

 更新時(shí)間:2026年02月07日 15:14:36   作者:isea533  
今天小編就為大家分享一篇關(guān)于批量將現(xiàn)有Jar包上傳到Maven私服,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧

基本信息

適用環(huán)境:內(nèi)網(wǎng)環(huán)境下的 Maven 私 服,無(wú)法連接外網(wǎng)(或者需要翻),需要通過(guò)其他手段下載完依賴(lài)后導(dǎo)入到內(nèi)網(wǎng)私 服的情況。

功能描述:

單個(gè)依賴(lài)包含的pom,jar等文件應(yīng)該在一個(gè)單獨(dú)的目錄中,可以指定下面的路徑,上傳 gson 到私 服。

還可以指定到f:\\.m2\\repository\\Gson\\gson,上傳gson的多個(gè)版本。

也可以直接f:\\.m2\\repository,將整個(gè)倉(cāng)庫(kù)下面的所有jar包的所有版本都上傳到私服。

注意:上傳前,如果允許重復(fù)上傳到私服,就需要在私服配置,允許 redeploy,否則已經(jīng)存在的會(huì)報(bào)錯(cuò)。

下載Jar 包

如果是下載單個(gè)的jar包,可以從 http://mvnrepository.com/ 搜素下載,下載的時(shí)候(根據(jù)連接打開(kāi)一個(gè)地址,下載pom,jar,source,javadoc)。

如果是針對(duì)項(xiàng)目,可以先配置一個(gè)新的本地倉(cāng)庫(kù)路徑(避免和已有jar攪和一起不好區(qū)分)。

為了可以下載source和javadoc,在 settings.xml 中增加下面的配置:

<profiles> 
 <profile> 
  <id>downloadSources</id> 
  <properties> 
   <downloadSources>true</downloadSources> 
<downloadJavadocs>true</downloadJavadocs>      
  </properties> 
 </profile> 
</profiles> 
<activeProfiles> 
 <activeProfile>downloadSources</activeProfile> 
</activeProfiles> 

在項(xiàng)目下面執(zhí)行:mvn clean install命令。

執(zhí)行完成后,再次執(zhí)行:mvn dependency:sources下載源碼。

如果需要 javadoc ,可以執(zhí)行命令:mvn dependency:resolve -Dclassifier=javadoc

需要在 settings.xml 中設(shè)置好賬號(hào)密碼,參考如下。

<server>
  <id>thirdpart</id>
  <username>admin</username>
  <password>123456</password>
</server>

上傳命令

使用下面的命令可以上傳依賴(lài)到私服。

mvn deploy:deploy-file -Durl=file:///home/me/m2-repo -DrepositoryId=some.repo.id -Dfile=./path/to/artifact-name-1.0.jar -DpomFile=./path/to/pom.xml -Dsources=./path/to/artifact-name-1.0-sources.jar -Djavadoc=./path/to/artifact-name-1.0-javadoc.jar

自動(dòng)化

手動(dòng)使用這個(gè)命令上傳時(shí),還不如直接通過(guò)nexus的前臺(tái)進(jìn)行上傳,為了可以自動(dòng)批量上傳,我們可以寫(xiě)個(gè)小程序來(lái)利用這個(gè)命令進(jìn)行批量操作。

當(dāng)寫(xiě)一個(gè)可以批量上傳依賴(lài)的程序時(shí),還需要考慮如果packaging=pom或者packaging=bundle時(shí),需要特殊處理。pom時(shí),Dfile DpomFile兩個(gè)參數(shù)都指定為pom文件即可,bundle時(shí),需要指定-Dpackaging=jar,由于jar時(shí)這個(gè)參數(shù)也沒(méi)問(wèn)題,所以無(wú)論bundle還是jar都帶上這個(gè)命令。

下面開(kāi)始代碼。

/**
 * 上傳依賴(lài)到 Maven 私服
 * @author
 * @since
 */
public class Deploy {
  /**
   * mvn -s F:\.m2\settings.xml
   * deploy:deploy-file 
   * -Durl=http://IP:PORT/nexus/content/repositories/thirdpart 
   * -DrepositoryId=thirdpart
   * -Dfile=antlr-2.7.2.jar
   * -DpomFile=antlr-2.7.2.pom
   * -Dpackaging=jar
   * -DgeneratePom=false
   * -Dsources=./path/to/artifact-name-1.0-sources.jar
   * -Djavadoc=./path/to/artifact-name-1.0-javadoc.jar
   */
  public static final String BASE_CMD = "cmd /c mvn " +
      "-s F:\\.m2\\settings.xml " + 
      "deploy:deploy-file " +
      "-Durl=http://IP:PORT/nexus/content/repositories/thirdpart " +
      "-DrepositoryId=thirdpart " +
      "-DgeneratePom=false";
  public static final Pattern DATE_PATTERN = Pattern.compile("-[\\d]{8}\\.[\\d]{6}-");
  public static final Runtime CMD = Runtime.getRuntime();
  public static final Writer ERROR;
  public static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(10);

先看第一部分,BASE_CMD 是基礎(chǔ)的命令部分。

  • cmd /c 可以保證使用 Java 的runtime 執(zhí)行命令時(shí),可以找到命令。
  • -s F:\\.m2\\settings.xml 參數(shù)指定了配置文件的路徑(避免多個(gè)配置的時(shí)候不知道配置那個(gè))。
  • deploy:deploy-file 是上傳文件的命令。
  • -Durl=xxx指定了上傳的位置,從nexus中可以找到這個(gè)地址。
  • -DrepositoryId=thirdpart必須和上面指定的地址一致,從nexus倉(cāng)庫(kù)配置可以看到這個(gè)id,另外上面提到的settings.xml中的用戶(hù)密碼要和這個(gè)id匹配。
  • -DgeneratePom=false因?yàn)槲覀儠?huì)傳pom文件,所以禁用自動(dòng)生成。

后面的DATE_PATTERN主要是存在快照版時(shí),忽略日期形式的版本,只保留SNAPSHOT形式的。

再后面獲取了一個(gè)CMD和一個(gè)線程池。

繼續(xù)代碼。

  static {
    Writer err = null;
    try {
      err = new OutputStreamWriter(new FileOutputStream("deploy-error.log"), "utf-8");
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(0);
    }
    ERROR = err;
  }
  public static void error(String error){
    try {
      System.err.println(error);
      ERROR.write(error + "\n");
      ERROR.flush();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

創(chuàng)建了一個(gè)文件來(lái)記錄錯(cuò)誤信息,并且提供了一個(gè)靜態(tài)方法方便使用。

下面是參數(shù)校驗(yàn)和提示信息。

  public static boolean checkArgs(String[] args){
    if (args.length != 1) {
      System.out.println("用法如: java -jar Deploy D:\\some\\path\\");
      return false;
    }
    File file = new File(args[0]);
    if (!file.exists()) {
      System.out.println(args[0] + " 目錄不存在!");
      return false;
    }
    if (!file.isDirectory()) {
      System.out.println("必須指定為目錄!");
      return false;
    }
    return true;
  }

下面方法判斷pom文件的packaging 是否為 pom:

  public static boolean packingIsPom(File pom){
    BufferedReader reader = null;
    try {
      BufferedReader reader = 
       new BufferedReader(new InputStreamReader(new FileInputStream(pom)));
      String line;
      while((line = reader.readLine()) != null){
        if(line.trim().indexOf("<packaging>pom</packaging>")!=-1){
          return true;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
     try{reader.close();}catch(Exception e){}
    }
    return false;
  }

當(dāng)為pom類(lèi)型時(shí),只需要上傳pom。

public static void deployPom(final File pom) {
    EXECUTOR_SERVICE.execute(new Runnable() {
      @Override
      public void run() {
        StringBuffer cmd = new StringBuffer(BASE_CMD);
        cmd.append(" -DpomFile=").append(pom.getName());
        cmd.append(" -Dfile=").append(pom.getName());
        try {
          final Process proc = CMD.exec(cmd.toString(), null, pom.getParentFile());
          InputStream inputStream = proc.getInputStream();
          InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
          BufferedReader reader = new BufferedReader(inputStreamReader);
          String line;
          StringBuffer logBuffer = new StringBuffer();
          logBuffer.append("\n\n\n=====================================\n");
          while((line = reader.readLine()) != null){
            if (line.startsWith("[INFO]") || line.startsWith("Upload")) {
              logBuffer.append(
               Thread.currentThread().getName() + " : " + line + "\n");
            }
          }
          System.out.println(logBuffer);
          int result = proc.waitFor();
          if(result != 0){
            error("上傳失?。? + pom.getAbsolutePath());
          }
        } catch (IOException e) {
          error("上傳失敗:" + pom.getAbsolutePath());
          e.printStackTrace();
        } catch (InterruptedException e) {
          error("上傳失?。? + pom.getAbsolutePath());
          e.printStackTrace();
        }
      }
    });
  }

注意DpomFile和Dfile都指定的pom文件。

當(dāng)上傳的文件包含 jar 時(shí),使用下面的方式。

  public static void deploy(
   final File pom, final File jar, final File source, final File javadoc) {
    EXECUTOR_SERVICE.execute(new Runnable() {
      @Override
      public void run() {
        StringBuffer cmd = new StringBuffer(BASE_CMD);
        cmd.append(" -DpomFile=").append(pom.getName());
        if(jar != null){
          //當(dāng)有bundle類(lèi)型時(shí),下面的配置可以保證上傳的jar包后綴為.jar
          cmd.append(" -Dpackaging=jar -Dfile=").append(jar.getName());
        } else {
          cmd.append(" -Dfile=").append(pom.getName());
        }
        if(source != null){
          cmd.append(" -Dsources=").append(source.getName());
        }
        if(javadoc != null){
          cmd.append(" -Djavadoc=").append(javadoc.getName());
        }
        try {
          final Process proc = CMD.exec(cmd.toString(), null, pom.getParentFile());
          InputStream inputStream = proc.getInputStream();
          InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
          BufferedReader reader = new BufferedReader(inputStreamReader);
          String line;
          StringBuffer logBuffer = new StringBuffer();
          logBuffer.append("\n\n\n=====================================\n");
          while((line = reader.readLine()) != null){
            if (line.startsWith("[INFO]") || line.startsWith("Upload")) {
              logBuffer.append(
               Thread.currentThread().getName() + " : " + line + "\n");
            }
          }
          System.out.println(logBuffer);
          int result = proc.waitFor();
          if(result != 0){
            error("上傳失敗:" + pom.getAbsolutePath());
          }
        } catch (IOException e) {
          error("上傳失?。? + pom.getAbsolutePath());
          e.printStackTrace();
        } catch (InterruptedException e) {
          error("上傳失敗:" + pom.getAbsolutePath());
          e.printStackTrace();
        }
      }
    });
  }

必須有pom和jar,source和javadoc可選。

下面是一個(gè)對(duì)上面代碼封裝后的方法,這個(gè)方法用于迭代查找包含pom,jar,source和javadoc的目錄和文件。

  public static void deploy(File[] files) {
    if (files.length == 0) {
      //ignore
    } else if (files[0].isDirectory()) {
      for (File file : files) {
        if (file.isDirectory()) {
          deploy(file.listFiles());
        }
      }
    } else if (files[0].isFile()) {
      File pom = null;
      File jar = null;
      File source = null;
      File javadoc = null;
      //忽略日期快照版本,如 xxx-mySql-2.2.6-20170714.095105-1.jar
      for (File file : files) {
        String name = file.getName();
        if(DATE_PATTERN.matcher(name).find()){
          //skip
        } else if (name.endsWith(".pom")) {
          pom = file;
        } else if (name.endsWith("-javadoc.jar")) {
          javadoc = file;
        } else if (name.endsWith("-sources.jar")) {
          source = file;
        } else if (name.endsWith(".jar")) {
          jar = file;
        }
      }
      if(pom != null){
        if(jar != null){
          deploy(pom, jar, source, javadoc);
        } else if(packingIsPom(pom)){
          deployPom(pom);
        }
      }
    }
  }

在main方法中,有兩種調(diào)用方式。

  public static void main(String[] args) {
    deploy(new File("F:\\.m2\\repository").listFiles());
    EXECUTOR_SERVICE.shutdown();
    try {
      ERROR.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

直接指定一個(gè)倉(cāng)庫(kù)的目錄即可。

還可以是更具體的目錄:

deploy(new File("F:\\.m2\\repository\\org\\apache\\tomcat\\xxx\\1.0.0\\").listFiles());

如果想通過(guò)命令行調(diào)用時(shí)指定目錄,可以用下面的main方法。

  public static void main(String[] args) {
    if(checkArgs(args)){
      File file = new File(args[0]);
      deploy(file.listFiles());
    }
    EXECUTOR_SERVICE.shutdown();
    try {
      ERROR.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

通過(guò)上面這種方式可以很輕易的將依賴(lài)傳到私服中。如果修改上面url參數(shù)為-Durl=E:\\.m2\\repository,還可以打包到本地倉(cāng)庫(kù)中。

雖然內(nèi)網(wǎng)使用私服的情況不常見(jiàn),如果遇到這種情況,使用這個(gè)代碼批量傳多少jar包都會(huì)變得很容易。

完整代碼

import java.io.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Pattern;
/**
 * 上傳依賴(lài)到 Maven 私服
 * @author 
 * @since
 */
public class Deploy {
  /**
   * mvn -s F:\.m2\settings.xml
   * org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file
   * -Durl=http://IP:PORT/nexus/content/repositories/thirdpart
   * -DrepositoryId=thirdpart
   * -Dfile=antlr-2.7.2.jar
   * -DpomFile=antlr-2.7.2.pom
   * -Dpackaging=jar
   * -DgeneratePom=false
   * -Dsources=./path/to/artifact-name-1.0-sources.jar
   * -Djavadoc=./path/to/artifact-name-1.0-javadoc.jar
   */
  public static final String BASE_CMD = "cmd /c mvn " +
      "-s F:\\.m2\\settings.xml " + 
      "deploy:deploy-file " +
      "-Durl=http://IP:PORT/nexus/content/repositories/thirdpart " +
      "-DrepositoryId=thirdpart " +
      "-DgeneratePom=false";
  public static final Pattern DATE_PATTERN = Pattern.compile("-[\\d]{8}\\.[\\d]{6}-");
  public static final Runtime CMD = Runtime.getRuntime();
  public static final Writer ERROR;
  public static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(10);
  static {
    Writer err = null;
    try {
      err = new OutputStreamWriter(new FileOutputStream("deploy-error.log"), "utf-8");
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(0);
    }
    ERROR = err;
  }
  public static void main(String[] args) {
    deploy(new File("F:\\.m2\\repository").listFiles());
//    if(checkArgs(args)){
//      File file = new File(args[0]);
//      deploy(file.listFiles());
//    }
    EXECUTOR_SERVICE.shutdown();
    try {
      ERROR.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public static void error(String error){
    try {
      System.err.println(error);
      ERROR.write(error + "\n");
      ERROR.flush();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public static boolean checkArgs(String[] args){
    if (args.length != 1) {
      System.out.println("用法如: java -jar Deploy D:\\some\\path\\");
      return false;
    }
    File file = new File(args[0]);
    if (!file.exists()) {
      System.out.println(args[0] + " 目錄不存在!");
      return false;
    }
    if (!file.isDirectory()) {
      System.out.println("必須指定為目錄!");
      return false;
    }
    return true;
  }
  public static void deploy(File[] files) {
    if (files.length == 0) {
      //ignore
    } else if (files[0].isDirectory()) {
      for (File file : files) {
        if (file.isDirectory()) {
          deploy(file.listFiles());
        }
      }
    } else if (files[0].isFile()) {
      File pom = null;
      File jar = null;
      File source = null;
      File javadoc = null;
      //忽略日期快照版本,如 xxx-mySql-2.2.6-20170714.095105-1.jar
      for (File file : files) {
        String name = file.getName();
        if(DATE_PATTERN.matcher(name).find()){
          //skip
        } else if (name.endsWith(".pom")) {
          pom = file;
        } else if (name.endsWith("-javadoc.jar")) {
          javadoc = file;
        } else if (name.endsWith("-sources.jar")) {
          source = file;
        } else if (name.endsWith(".jar")) {
          jar = file;
        }
      }
      if(pom != null){
        if(jar != null){
          deploy(pom, jar, source, javadoc);
        } else if(packingIsPom(pom)){
          deployPom(pom);
        }
      }
    }
  }
  public static boolean packingIsPom(File pom){
    BufferedReader reader = null;
    try {
      BufferedReader reader = 
       new BufferedReader(new InputStreamReader(new FileInputStream(pom)));
      String line;
      while((line = reader.readLine()) != null){
        if(line.trim().indexOf("<packaging>pom</packaging>")!=-1){
          return true;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
     try{reader.close();}catch(Exception e){}
    }
    return false;
  }
  public static void deployPom(final File pom) {
    EXECUTOR_SERVICE.execute(new Runnable() {
      @Override
      public void run() {
        StringBuffer cmd = new StringBuffer(BASE_CMD);
        cmd.append(" -DpomFile=").append(pom.getName());
        cmd.append(" -Dfile=").append(pom.getName());
        try {
          final Process proc = CMD.exec(cmd.toString(), null, pom.getParentFile());
          InputStream inputStream = proc.getInputStream();
          InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
          BufferedReader reader = new BufferedReader(inputStreamReader);
          String line;
          StringBuffer logBuffer = new StringBuffer();
          logBuffer.append("\n\n\n==================================\n");
          while((line = reader.readLine()) != null){
            if (line.startsWith("[INFO]") || line.startsWith("Upload")) {
              logBuffer.append(Thread.currentThread().getName() + " : " + line + "\n");
            }
          }
          System.out.println(logBuffer);
          int result = proc.waitFor();
          if(result != 0){
            error("上傳失?。? + pom.getAbsolutePath());
          }
        } catch (IOException e) {
          error("上傳失?。? + pom.getAbsolutePath());
          e.printStackTrace();
        } catch (InterruptedException e) {
          error("上傳失?。? + pom.getAbsolutePath());
          e.printStackTrace();
        }
      }
    });
  }
  public static void deploy(final File pom, final File jar, final File source, final File javadoc) {
    EXECUTOR_SERVICE.execute(new Runnable() {
      @Override
      public void run() {
        StringBuffer cmd = new StringBuffer(BASE_CMD);
        cmd.append(" -DpomFile=").append(pom.getName());
        if(jar != null){
          //當(dāng)有bundle類(lèi)型時(shí),下面的配置可以保證上傳的jar包后綴為.jar
          cmd.append(" -Dpackaging=jar -Dfile=").append(jar.getName());
        } else {
          cmd.append(" -Dfile=").append(pom.getName());
        }
        if(source != null){
          cmd.append(" -Dsources=").append(source.getName());
        }
        if(javadoc != null){
          cmd.append(" -Djavadoc=").append(javadoc.getName());
        }
        try {
          final Process proc = CMD.exec(cmd.toString(), null, pom.getParentFile());
          InputStream inputStream = proc.getInputStream();
          InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
          BufferedReader reader = new BufferedReader(inputStreamReader);
          String line;
          StringBuffer logBuffer = new StringBuffer();
          logBuffer.append("\n\n\n=======================================\n");
          while((line = reader.readLine()) != null){
            if (line.startsWith("[INFO]") || line.startsWith("Upload")) {
              logBuffer.append(Thread.currentThread().getName() + " : " + line + "\n");
            }
          }
          System.out.println(logBuffer);
          int result = proc.waitFor();
          if(result != 0){
            error("上傳失?。? + pom.getAbsolutePath());
          }
        } catch (IOException e) {
          error("上傳失?。? + pom.getAbsolutePath());
          e.printStackTrace();
        } catch (InterruptedException e) {
          error("上傳失?。? + pom.getAbsolutePath());
          e.printStackTrace();
        }
      }
    });
  }
}

使用方式

1.導(dǎo)入項(xiàng)目直接運(yùn)行 main 方法。

2.使用 javac 編譯為class后運(yùn)行,由于代碼存在中文,java代碼需要使用utf8格式保存,編譯時(shí)通過(guò)-encoding utf8參數(shù)指定。

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接

相關(guān)文章

  • Java收集的雪花算法代碼詳解

    Java收集的雪花算法代碼詳解

    這篇文章主要介紹了Java實(shí)現(xiàn)雪花算法的詳細(xì)代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-10-10
  • JSON Web Token在登陸中的使用過(guò)程

    JSON Web Token在登陸中的使用過(guò)程

    這篇文章主要介紹了JSON Web Token在登陸中的使用過(guò)程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2025-04-04
  • java線程池合理設(shè)置最大線程數(shù)和核心線程數(shù)方式

    java線程池合理設(shè)置最大線程數(shù)和核心線程數(shù)方式

    這篇文章主要介紹了java線程池合理設(shè)置最大線程數(shù)和核心線程數(shù)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-12-12
  • Java正則表達(dá)式之Pattern類(lèi)實(shí)例詳解

    Java正則表達(dá)式之Pattern類(lèi)實(shí)例詳解

    Pattern類(lèi)的作用在于編譯正則表達(dá)式后創(chuàng)建一個(gè)匹配模式,下面這篇文章主要給大家介紹了關(guān)于Java正則表達(dá)式之Pattern類(lèi)的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-01-01
  • Java中注解與原理分析詳解

    Java中注解與原理分析詳解

    注解即標(biāo)注與解析,在Java的代碼工程中,注解的使用幾乎是無(wú)處不在,甚至多到被忽視。本文就來(lái)和大家詳細(xì)說(shuō)說(shuō)Java中注解的原理與實(shí)現(xiàn),需要的可以參考一下
    2022-11-11
  • Spring?Security實(shí)現(xiàn)用戶(hù)名密碼登錄詳解

    Spring?Security實(shí)現(xiàn)用戶(hù)名密碼登錄詳解

    這篇文章主要為大家詳細(xì)介紹了Spring Security如何實(shí)現(xiàn)用戶(hù)名密碼登錄功能,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起了解一下
    2022-10-10
  • 使用Java生成JWT令牌的示例代碼

    使用Java生成JWT令牌的示例代碼

    json-web-token簡(jiǎn)稱(chēng)java web令牌,也稱(chēng)作JWT,是一種可以實(shí)現(xiàn)跨域身份驗(yàn)證身份的方案,jwt不加密傳輸數(shù)據(jù),但能夠通過(guò)數(shù)據(jù)前面驗(yàn)證數(shù)據(jù)的未被篡改,本文給大家介紹了如何使用Java生成JWT令牌,需要的朋友可以參考下
    2024-04-04
  • maven?helper?jar包沖突的幾種解決方法

    maven?helper?jar包沖突的幾種解決方法

    maven Helper是排查jar包沖突的一大利器,jar包沖突大部分是由于引用了同一個(gè)jar的不同版本而導(dǎo)致的,本文主要介紹了maven?helper?jar包沖突的幾種解決方法,感興趣的可以了解一下
    2024-03-03
  • 基于Nacos實(shí)現(xiàn)動(dòng)態(tài)線程池的設(shè)計(jì)與實(shí)踐分享

    基于Nacos實(shí)現(xiàn)動(dòng)態(tài)線程池的設(shè)計(jì)與實(shí)踐分享

    在分布式系統(tǒng)架構(gòu)中,線程池是資源調(diào)度的重要工具,傳統(tǒng)固定參數(shù)的線程池在流量平穩(wěn)的場(chǎng)景下表現(xiàn)良好,但面對(duì)現(xiàn)代互聯(lián)網(wǎng)業(yè)務(wù)的潮汐流量特征時(shí),往往會(huì)出現(xiàn)資源浪費(fèi)或處理能力不足的問(wèn)題,所以本文將介紹基于Nacos實(shí)現(xiàn)動(dòng)態(tài)線程池的設(shè)計(jì)與實(shí)踐,需要的朋友可以參考下
    2025-05-05
  • SpringBoot?熱搜與不雅文字過(guò)濾的實(shí)現(xiàn)

    SpringBoot?熱搜與不雅文字過(guò)濾的實(shí)現(xiàn)

    本文主要介紹了SpringBoot?熱搜與不雅文字過(guò)濾的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-07-07

最新評(píng)論

江西省| 阿合奇县| 九江县| 灌南县| 普兰县| 黔西| 社旗县| 九江市| 东城区| 永州市| 丹巴县| 米脂县| 杂多县| 巴彦淖尔市| 中牟县| 安国市| 抚松县| 林西县| 辽阳市| 常山县| 金川县| 陆河县| 油尖旺区| 比如县| 恩施市| 乌兰浩特市| 罗城| 探索| 湖南省| 公安县| 万盛区| 桓仁| 尼勒克县| 炎陵县| 那曲县| 胶南市| 江都市| 婺源县| 城固县| 天长市| 阳江市|