今天在Eclipse配置Spring框架时发现不能在Eclipse的pom.xml->Dependencies->Add...加载spring-webmvc的框架

解决eclipse maven插件 add dependencies搜索不到spring-webmvc的问题

在此处输入spring-webmvc没有反应,只有本地的包能搜索到。

解决方案:

1.Windows->Preferences

.解决eclipse maven插件 add dependencies搜索不到spring-webmvc的问题

在User Settings标题所示的目录下创建setting.xml,里面的内容为:

<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <mirrors>
        <mirror>
            <id>Nexus</id>
            <name>Nexus Public Mirror</name>
            <url>http://121.42.166.202:8081/nexus/content/groups/public</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>

    <profiles>
        <profile>
            <id>dev</id>
            <repositories>
                <repository>
                    <id>Nexus</id>
                    <url>http://121.42.166.202:8081/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>fail</checksumPolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>Nexus</id>
                    <url>http://121.42.166.202:8081/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                        <checksumPolicy>warn</checksumPolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <checksumPolicy>fail</checksumPolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
            <!-- <properties> <environment.type>prod</environment.type> </properties> -->
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>dev</activeProfile>
    </activeProfiles>
</settings>

2.创建完毕后,去勾选

解决eclipse maven插件 add dependencies搜索不到spring-webmvc的问题这一个条目

具体位置如下:

解决eclipse maven插件 add dependencies搜索不到spring-webmvc的问题

3.Apply and Close后,按alt+f5重构项目

解决eclipse maven插件 add dependencies搜索不到spring-webmvc的问题

把重构的项目勾上就行,然后就需要等待一下,时间后有些长,我大概花了5分钟左右,才完成。

下方有两个参考的帖子:

https://blog.csdn.net/my13413527259/article/details/78367180

http://www.cnblogs.com/ClassNotFoundException/p/6262445.html?utm_source=itdadao&utm_medium=referral

相关文章:

  • 2022-02-08
  • 2021-08-25
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
猜你喜欢
  • 2023-03-19
  • 2021-07-05
  • 2021-04-07
  • 2021-08-05
  • 2021-06-22
  • 2022-12-23
相关资源
相似解决方案