<aside> 💡

idea Maven 常见解决问题思路

spring boot项目启动报错:Failed to load property source from location ‘classpath:/application.yml‘

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

[**The following method did not exist: kotlin.collections.ArraysKt.copyInto([B[BIII)B**

springboot3.2.0报Name for argument of type [java.lang.String] not specified, and parameter name inf

全局异常信息 ex=No static resource favicon.ico.

Caused by: java.lang.NoClassDefFoundError: org/springframework/data/redis/serializer/RedisSerializer

SpringBoot报错: Error creating bean with name freeMarkerConfigurer defined in class path resource

Could not resolve dependencies for project com.wright:module-common:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: jdk.tools:jdk.tools:jar:1.6: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path /usr/lib/jvm/java-21-amazon-corretto/../lib/tools.jar

</aside>

maven-default-http-blocker

Maven在升级到3.8.1以后,从安全角度考虑,默认将https的远端仓库屏蔽掉了

方法1. 注释Maven配置文件的Block设定,settings.xml 文件的位置: $MAVEN_HOME/conf/settings.xml

    <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url><http://0.0.0.0/></url>
      <blocked>true</blocked>
    </mirror>

方法2: 使用给dummy镜像覆盖掉默认配置中的镜像配置(可以在~/.m2/settings.xml配置)

       <mirror>
            <id>maven-default-http-blocker</id>
            <mirrorOf>external:dummy:*</mirrorOf>
            <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
            <url><http://0.0.0.0/></url>
            <blocked>true</blocked>
        </mirror>
AI运行代码1234567

方法3: 为该http源增加如下mirror配置, 也就是对于指定的库不阻止。

<mirror>
  <id>insecure-repo</id>
  <mirrorOf>external:http:*</mirrorOf>
  <url><http://hostname:8081/repository/maven-public/></url>
  <blocked>false</blocked>
</mirror>

方法4:降低Maven版本到 3.8.1以下

方法5:让这个http的Maven库支持https, 转换https 涉及到https 相关的证书产生和签名, 但是这是最安全的方式。

POM 引入了, import 找不到

  1. 查看External Libraries是否有类文件(有这个依赖,类是空的)
  2. 在maven中找到该文件夹,删除重新瞎下载,查看是否有类文件(删除,重新clean install测试,查看是否有类文件)
  3. 确定阿里云缓存问题
  4. 删除项目阿里云镜像地址(看运气哈,我 windows 用阿里云镜像就是有问题)
  5. 删除maven setting 镜像地址
  6. 用原始仓库下载,没有科学代理洗洗下班睡觉
  7. 还不行就是 install 后关闭清理缓存关闭 idea