日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

警告提示:No archetype found in remote catalog. Archetype not found in any catalog

發布時間:2023/12/3 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 警告提示:No archetype found in remote catalog. Archetype not found in any catalog 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

IDEA 使用 archetype(原型/模板/骨架)創建 Maven 項目時,

最后提示:

No archetype found in remote catalog. Defaulting to internal catalog Archetype not found in any catalog. Falling back to central repository. Add a repository with id ‘archetype’ in your settings.xml if archetype’s repository is elsewhere.

原因:
找不到遠程的 archetype-catalog.xml,在內部的 archetype 目錄冊中也找不到你要的 archetype,建議你在 settings.xml 中配置 archetype 倉庫。

實際上在 http://repo1.maven.org/maven2/ 倉庫存在 archetype-catalog.xml 文件,下載地址:https://repo1.maven.org/maven2/archetype-catalog.xml。

但是我在 settings.xml 聲明這個遠程倉庫后,

<mirror><id>repo1</id><name>Human Readable Name for this Mirror.</name><url>http://repo1.maven.org/maven2/</url><mirrorOf>central</mirrorOf> </mirror>

在命令終端輸入命令 mvn archetype:generate 同樣會提示下面的警告信息:

[WARNING] No archetype found in remote catalog. Defaulting to internal catalog

我沒有理解 No archetype found in remote catalog 這段文字的含義。

臨時解決:

我點擊上述的 archetype-catalog.xml 下載鏈接,下載了 archetype-catalog.xml 文件。

將 archetype-catalog.xml 文件移動到 ~/.m2/repository 目錄下(本地倉庫的根目錄),然后 IDEA 中配置下面的參數:

然后 IDEA 使用 archetype 創建 Maven 項目,就沒有上面的提示了。

其實上面的做法只是屏蔽了訪問遠程倉庫的 catalog 而已,指定 IDEA 通過 archetype 創建項目的時候,只讀取本地的 catalog。

默認是先查詢遠程的,再查詢本地的,再查詢內置的。

命令行下,你可以使用參數 archetypeCatalog=local,表示只讀取本地的 catalog。參數值有三個:remote、local、internal。

[~/documents/ideaprojects]$ mvn archetype:generate -DarchetypeCatalog=local [INFO] Scanning for projects... [INFO] [INFO] ------------------< org.apache.maven:standalone-pom >------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] >>> maven-archetype-plugin:3.2.1:generate (default-cli) > generate-sources @ standalone-pom >>> [INFO] [INFO] <<< maven-archetype-plugin:3.2.1:generate (default-cli) < generate-sources @ standalone-pom <<< [INFO] [INFO] [INFO] --- maven-archetype-plugin:3.2.1:generate (default-cli) @ standalone-pom --- [INFO] Generating project in Interactive mode [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0) Choose archetype: 1: local -> am.ik.archetype:elm-spring-boot-blank-archetype (Blank multi project for Spring Boot + Elm) 2: local -> am.ik.archetype:graalvm-blank-archetype (Blank project for GraalVM) 3: local -> am.ik.archetype:graalvm-springmvc-blank-archetype (Blank project for GraalVM + Spring MVC) 4: local -> am.ik.archetype:graalvm-springwebflux-blank-archetype (Blank project for GraalVM + Spring MVC) 5: local -> am.ik.archetype:maven-reactjs-blank-archetype (Blank Project for React.js) ...

執行上述的命令后,你在命令終端可以看到所有可用的 archetype 列表,你需要輸入對應的編號,然后按下回車鍵,那么 Maven 就會按你選擇的 archetype 在當前目錄下生成項目的整體結構。如果你需要使用 IDE 來開發項目,那么你需要導入該項目。

總結

以上是生活随笔為你收集整理的警告提示:No archetype found in remote catalog. Archetype not found in any catalog的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。