spring boot项目eclipse中启动访问jsp/html,打包不能访问jsp/html问题总结

版权声明:未经允许禁止转载、转发 https://blog.csdn.net/qq_22764659/article/details/85339357

这个问题主要是pom.xmlbuild的问题。
首先是你的jsp资源打包放入META-INF/resources中,这样才能访问到jsphtml才能打包到你的项目中去。

```xml

	<build>
		<resources>
			<resource>
				<directory>src/main/webapp</directory>
				<targetPath>META-INF/resources</targetPath>
				<includes>
					<include>**/**</include>
				</includes>
			</resource>
			<resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/**</include>
                </includes>
                <filtering>false</filtering>
            </resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>1.4.2.RELEASE</version>
				<configuration>
                    <mainClass>com.asphalt.WebApplication</mainClass>
                </configuration>
                 <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
			</plugin>
			 <!-- 忽略无web.xml警告 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
		</plugins>
	</build>

其次是 <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> 添加如下版本

<version>1.4.2.RELEASE</version> 这个version必不可少

最后,如果小编的方法行不通,请百度不断尝试 吧

猜你喜欢

转载自blog.csdn.net/qq_22764659/article/details/85339357
今日推荐