idea中的Maven导包失败问题解决总结

idea中的Maven导包失败问题解决总结

  1. 先确定idea和Maven 的配置文件settings 没有问题

    找到我们本地的maven仓库,默认的maven仓库路径是在\C:\Users\用户名.m2下

    有两个文件夹,repositotry是放具体jar包的,根据报错包的名,找对应文件夹就能找到对应jar包的位置

    在这里插入图片描述

    wrapper 是放maven 安装文件的,在所有安装文件中找到conf 文件下的settings.xml 文件,确保文件正确,比如有阿里云镜像源

    在这里插入图片描述

    在这里插入图片描述

    将settings文件加入阿里云镜像源,对应的jdk版本 等

    正确的setings.xml,可直接复制内容替换掉原来的文件

    <!-- localRepository   | The path to the local repository maven will use to store artifacts.   |   | Default: ${user.home}/.m2/repository  /path/to/local/repo  -->	D:\repository  <!-- interactiveMode   | This will determine whether maven prompts you when it needs input. If set to false,   | maven will use a sensible default value, perhaps based on some other setting, for   | the parameter in question.   |   | Default: true  true  -->   <!-- offline   | Determines whether maven should attempt to connect to the network when executing a build.   | This will have an effect on artifact downloads, artifact deployment, and others.   |   | Default: false  false  -->         <!-- pluginGroup     | Specifies a further group identifier to use for plugin lookup.    com.your.plugins    -->           <!-- proxy     | Specification for one proxy, to be used in connecting to the network.     |          optional      true      http      proxyuser      proxypass      proxy.host.net      80      local.net|some.host.com        -->           <!-- server     | Specifies the authentication information to use when connecting to a particular server, identified by     | a unique name within the system (referred to by the 'id' attribute below).     |     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are     |       used together.     |          deploymentRepo      repouser      repopwd        -->     <!-- Another sample, using keys to authenticate.          siteServer      /path/to/private/key      optional; leave empty if not used.        -->           <!-- mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.     |          mirrorId      repositoryId      Human Readable Name for this Mirror.      http://my.repository.com/repo/path         -->	                        alimaven            central            aliyun maven            http://maven.aliyun.com/nexus/content/repositories/central/                                     repo1            central            Human Readable Name for this Mirror.            http://repo1.maven.org/maven2/                                     repo2            central            Human Readable Name for this Mirror.            http://repo2.maven.org/maven2/                   <!-- profile     | Specifies a set of introductions to the build process, to be activated using one or more of the     | mechanisms described above. For inheritance purposes, and to activate profiles via      | or the command line, profiles have to have an ID that is unique.     |     | An encouraged best practice for profile identification is to use a consistent naming convention     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.     | This will make it more intuitive to understand what the set of introduced profiles is attempting     | to accomplish, particularly when you only have a list of profile id's for debug.     |     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.          jdk-1.4              1.4                              jdk14          Repository for JDK 1.4 builds          http://www.myhost.com/maven/jdk14          default          always                      -->     <!--     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration     | might hypothetically look like:     |     | ...     |      |   org.myco.myplugins     |   myplugin     |     |        |     ${tomcatPath}     |        |      | ...     |     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to     |       anything, you could just leave off the  inside the activation-property.     |          env-dev                        target-env          dev                            /path/to/tomcat/instance              -->	           JDK-1.8                            true               1.8                                         1.8               1.8               1.8                             <!-- activeProfiles   | List of profiles that are active for all builds.   |      alwaysActiveProfile    anotherAlwaysActiveProfile    -->

同样还有idea 安装目录下的maven文件加下的配置文件settings.xml

在这里插入图片描述

在这里插入图片描述

2. 解决settings.xml配置文件问题,就找到报错对应的jar包文件夹,将其中的删除 _remote.repositories 文件和以Lastupdated结尾的文件,

以Lastupdated结尾的文件必须删除, _remote.repositories 文件选择性删除,可把 _remote.repositories 文件中的 nexus= 改成 central=,还是有问题就删除掉 _remote.repositories 文件。

可以直接在repositotry文件夹中搜索以Lastupdated结尾的文件,然后全部删除

在这里插入图片描述

3. 在 Settings – Maven – Runner – VM Options 中添加 -DarchetypeCatalog=internal,优先从本地仓库读取,添加-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true,忽略证书检查

在这里插入图片描述

命令

-DarchetypeCatalog=internal -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
  1. idea点击重新导包

    在这里插入图片描述

还有可能是springboot版本过高,

在这里插入图片描述

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/4bc83ac1f9.html