SpringBoot导入jsp依赖始终报错

 

先粘出我自己的pom代码:

 1 xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
 4     <modelVersion>4.0.0modelVersion>
 5     <parent>
 6         <groupId>org.springframework.bootgroupId>
 7         <artifactId>spring-boot-starter-parentartifactId>
 8         <version>1.5.6.RELEASEversion>
 9         <relativePath/> 
10     parent>
11     <groupId>com.sblueicegroupId>
12     <artifactId>demoartifactId>
13     <version>0.0.1-SNAPSHOTversion>
14     <packaging>warpackaging>
15     <name>demoname>
16     <description>Demo project for Spring Bootdescription>
17 
18     <properties>
19         <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
20         <project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
21         <java.version>1.8java.version>
22     properties>
23 
24     <dependencies>
25         <dependency>
26             <groupId>org.springframework.bootgroupId>
27             <artifactId>spring-boot-starter-webartifactId>
28         dependency>
29         <dependency>
30             <groupId>javax.servletgroupId>
31             <artifactId>javax.servlet-apiartifactId>
32             <scope>providedscope>
33         dependency>
34         
35          
36         <dependency>
37               <groupId>javax.servletgroupId>
38               <artifactId>jstlartifactId>
39               <version>1.2version>
40         dependency>
41 
42        <dependency>
43         <groupId>com.mchangegroupId>
44         <artifactId>c3p0artifactId>
45         <version>0.9.5.2version>
46     dependency>
47         
48         <dependency>
49             <groupId>org.springframework.bootgroupId>
50             <artifactId>spring-boot-starter-tomcatartifactId>
51             <scope>providedscope>
52         dependency>
53         <dependency>
54             <groupId>org.springframework.bootgroupId>
55             <artifactId>spring-boot-starter-testartifactId>
56             <scope>testscope>
57         dependency>
58         <dependency>
59             <groupId>org.springframework.bootgroupId>
60             <artifactId>spring-boot-devtoolsartifactId>
61             <optional>trueoptional>
62         dependency>
63                 <dependency>
64             <groupId>org.springframework.bootgroupId>
65             <artifactId>spring-boot-starter-jdbcartifactId>
66         dependency>
67         <dependency>
68             <groupId>org.mybatis.spring.bootgroupId>
69             <artifactId>mybatis-spring-boot-starterartifactId>
70             <version>1.3.2version>
71         dependency>
72         <dependency>
73             <groupId>mysqlgroupId>
74             <artifactId>mysql-connector-javaartifactId>
75             <scope>runtimescope>
76         dependency>
77 
78     dependencies>
79 
80     <build>
81         <plugins>
82             <plugin>
83                 <groupId>org.springframework.bootgroupId>
84                 <artifactId>spring-boot-maven-pluginartifactId>
85             plugin>
86            <plugin>
87                  <groupId>org.apache.maven.pluginsgroupId>
88                  <artifactId>maven-compiler-pluginartifactId>
89                  <version>3.1version>
90                  <configuration>
91                      <source>1.8source>     
92                      <target>1.8target>     
93                  configuration>
94            plugin>
95         plugins>
96     build>
97 
98 project>

 

修改一:先说父类依赖版本号,根据百度由2.0.1改为了1.5.6

SpringBoot导入jsp依赖始终报错_第1张图片

 

 修改二:再说导入jsp依赖的报错:Missing artifact org.apache.tomcat.embed:tomcat-embed-jasper:jar:8.5.16

 

 如果不添加jsp依赖,就直接下载jsp文件,添加了就报错,现在我已经懵了。。。。

记录一下,有大神解答更是求之不得!!!

 

2019-10-10自己已经解决

最后发现是版本的问题,从1.5.6测试到了2.0.3,发现2.0.3这个版本没有问题,证明了这个版本适合我的电脑和我的eclipse

  操作系统:win10 64位
  eclipse:Version: 2019-09 R (4.13.0)
  maven应该是3.5.0

1、下面是jsp需要的依赖

    
    <dependency>
      <groupId>javax.servletgroupId>
      <artifactId>javax.servlet-apiartifactId>
      <scope>providedscope>
    dependency>
    
    
    <dependency>
      <groupId>javax.servletgroupId>
      <artifactId>jstlartifactId>
      <version>1.2version>
    dependency>
    
    <dependency>
      <groupId>org.apache.tomcat.embedgroupId>
      <artifactId>tomcat-embed-jasperartifactId>
      <scope>providedscope>
    dependency>

 

2、接着是application.yml中添加前后缀

  spring:
    mvc:
      view:
        prefix: /WEB-INF/views
        suffix: .jsp

----与君共勉

 

你可能感兴趣的:(SpringBoot导入jsp依赖始终报错)