Advertisement

idea|创建springboot项目时遇到的问题

阅读量:

idea|创建springboot项目时遇到的问题

  • 创建项目后依赖无法导入

    • 出错情况
    • 解决办法
  • Meavn打包时报错,提示测试错误

    • 出错情况
    • 解决办法
  • 数据库连接失败

    • 解决办法

创建项目后依赖无法导入

出错情况

创建springboot项目时选择的依赖在maven中全部不能识别
使用idea创建springboot项目时添加了thymeleaf、lombok等常用插件时,Meavn中的依赖Dependencies下全部有红色波浪线报错。但是自己在pom.xml文件中后添加的依赖没有报错。

现在已解决:
报错情况(现在已解决)

解决办法

将报错的dependencies从pom.xml文件中删除,刷新Meavn目录。重新将依赖写在pom.xml文件中,再次刷新Meavn目录。

Meavn打包时报错,提示测试错误

出错情况

使用mvn package命令时会报错:
报错时控制台信息
控制台提示:

复制代码
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project demo: There are test failures.
    [ERROR]
    [ERROR] Please refer to D:\ideaProject\springboot_demo\target\surefire-reports for the individual test results.
    [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

与此同时,另一个正常的项目运行时如图:
正常运行时控制台信息

解决办法

在pom.xml中添加代码:

复制代码
    <build>
    	<plugins>
    		<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <skipTests>true</skipTests>//跳过测试
                </configuration>
     	</plugin>
     <plugins>
    </build>

数据库连接失败

报错信息如下:

复制代码
    com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:mysql://localhost:3306
控制台报错

解决办法

检查数据库地址、用户名、密码是否正确

全部评论 (0)

还没有任何评论哟~