JAVA后端搭建开发环境可能会遇到的问题

378 阅读1分钟

1.maven不支持http下载

Could not transfer artifact xxx-starter:pom:1.0-SNAPSHOT from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [/repository/maven-public/, default, releases+snapshots)]

高版本的maven不支持http下载镜像,只支持https下载,可将settings.xml中的如下mirror注释掉,或者修改为aliyun mirror

<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.误用JDK1.8为JDK18

搭建环境的过程中,本想下载JDK1.8,但误下载了JDK18,代码启动的过程中报了以下错误,更换为JDK1.8后问题解决

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxApi': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.xxx.xxxApi] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@27c170f0]

3.Local repository需修改默认值

Maven的Local repository需修改默认值,否则可能会报包依赖错误 image.png

image.png