• SpringBoot启动报错 java.lang.NoClassDefFoundError: javax/validation/ValidationException


      在做Springboot项目时,环境搭建启动正常,但是过了几天之后再启动就报些莫名奇妙的错误,网上百度了一大推,都不能解决问题,最后发现是自己的maven仓库环境缺了些配置,重新配置maven的settings文件,在编译启动就正常了。

    修改后的settings.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <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">
    <localRepository>D:Program Files
    epository</localRepository>
    
      <pluginGroups>
      </pluginGroups>
      <proxies>
      </proxies>
      <mirrors>
        
        <mirror>
            <id>alimaven</id>
             <name>aliyun maven</name>
             <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
             <mirrorOf>central</mirrorOf>
        </mirror>
        <mirror>
             <id>central</id>
             <name>Maven Repository Switchboard</name>
             <url>http://repo1.maven.org/maven2/</url>
             <mirrorOf>central</mirrorOf>
        </mirror>
        <mirror>
             <id>repo2</id>
             <mirrorOf>central</mirrorOf>
             <name>Human Readable Name for this Mirror.</name>
             <url>http://repo2.maven.org/maven2/</url>
        </mirror>
        <mirror>
             <id>ibiblio</id>
             <mirrorOf>central</mirrorOf>
             <name>Human Readable Name for this Mirror.</name>
             <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
        </mirror>
        <mirror>
             <id>jboss-public-repository-group</id>
             <mirrorOf>central</mirrorOf>
             <name>JBoss Public Repository Group</name>
             <url>http://repository.jboss.org/nexus/content/groups/public</url>
        </mirror>
        <!-- 中央仓库在中国的镜像 -->
        <mirror>
             <id>maven.net.cn</id>
             <name>oneof the central mirrors in china</name>
             <url>http://maven.net.cn/content/groups/public/</url>
             <mirrorOf>central</mirrorOf>
        </mirror>
      </mirrors>
      <profiles>
        <profile>    
            <id>jdk-1.8</id>    
            <activation>    
              <activeByDefault>true</activeByDefault>    
              <jdk>1.8</jdk>    
            </activation>    
            <properties>    
                <maven.compiler.source>1.8</maven.compiler.source>    
                <maven.compiler.target>1.8</maven.compiler.target>    
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>    
            </properties>    
        </profile>
      </profiles>
      <!--
        <activeProfiles>
        <activeProfile>dev</activeProfile>
        </activeProfiles>
        -->
    </settings>

    最后在pom.xml文件中添加以下插件(结合个人项目看是否添加)

     <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.7</version>
             <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.shared</groupId>
                            <artifactId>maven-filtering</artifactId>
                            <version>1.3</version>
                        </dependency>
             </dependencies>
    </plugin>

    总结:maven环境一定要配好,要不然以后做项目会报一些奇怪的问题。

  • 相关阅读:
    题解 P1003 【铺地毯】
    题解 P1000 【超级玛丽游戏】
    题解 P1036 【选数】
    题解 P1217 【[USACO1.5]回文质数 Prime Palindromes】
    题解 AT934 【完全数】
    题解 P2044 【[NOI2012]随机数生成器】
    题解 P4277 【河城荷取的烟花】
    System.Linq.Dynamic.Core
    008 TBS Studio 真机开发辅助工具的简单说明
    webpack
  • 原文地址:https://www.cnblogs.com/donleo123/p/14096554.html
Copyright © 2020-2023  润新知