org.springframework.boot.web.support가 존재하지 않습니다.
봄 부츠 프로젝트를 위해 제작 시스템을 메이브에서 그라데일로 변경하려고 합니다.이 스택 트레이스가
19:03:08: Executing external task 'bootRun'...
/home/dac/proj/spring-boot-master/spring-boot-samples/spring-boot-sample-jetty-jsp/src/main/java/sample/jetty/jsp/SampleJettyJspApplication.java:22: error: package org.springframework.boot.web.support does not exist
import org.springframework.boot.web.support.SpringBootServletInitializer;
^
/home/dac/proj/spring-boot-master/spring-boot-samples/spring-boot-sample-jetty-jsp/src/main/java/sample/jetty/jsp/SampleJettyJspApplication.java:25: error: cannot find symbol
public class SampleJettyJspApplication extends SpringBootServletInitializer {
^
symbol: class SpringBootServletInitializer
/home/dac/proj/spring-boot-master/spring-boot-samples/spring-boot-sample-jetty-jsp/src/main/java/sample/jetty/jsp/SampleJettyJspApplication.java:27: error: method does not override or implement a method from a supertype
@Override
^
3 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.334 secs
Compilation failed; see the compiler error output for details.
19:03:10: External task execution finished 'bootRun'.
나의build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE"
classpath 'org.springframework:springloaded:1.2.5.RELEASE'
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'rebel'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.zeroturnaround', name: 'gradle-jrebel-plugin', version: '1.1.3'
}
}
jar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
// tag::jetty[]
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
// end::jetty[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}
// change default IntelliJ output directory for compiling classes
idea {
module {
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
나의pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-samples</artifactId>
<version>1.4.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-sample-jetty-jsp</artifactId>
<packaging>war</packaging>
<name>Spring Boot Jetty JSP Sample</name>
<description>Spring Boot Jetty JSP Sample</description>
<url>http://projects.spring.io/spring-boot/</url>
<organization>
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
<m2eclipse.wtp.contextRoot>/</m2eclipse.wtp.contextRoot>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
</project>
어떻게 하면 그라데이션이 가능한 패키지를 만들 수 있을까요?
사용하고 있습니다.org.springframework.boot.context.web.SpringBootServletInitializer
이것은 권장되지 않습니다.대신:
사용하다
org.springframework.boot.web.support.SpringBootServletInitializer
Spring Boot 2.0의 경우
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
소스 코드의 Import 문제일 수 있습니다.Gradle 빌드 스크립트는 Spring Boot 1.3.6을 사용합니다.Spring Boot Servlet 릴리즈Initializer의 이름은 다음과 같습니다.
org.springframework.boot.context.web.SpringBootServletInitializer
단, Maven pom.xml은 Spring Boot 1.4.0을 사용합니다.BUILD-SNAPSHOT. 패키지 이름이 다음과 같이 변경되었습니다.
org.springframework.boot.web.support.SpringBootServletInitializer
따라서 SampleJettyJspApplication으로 이동하여 Import를 다음과 같이 변경합니다.
import org.springframework.boot.context.web.SpringBootServletInitializer;
모든 게 괜찮을 거야
또는 Gradle 빌드 스크립트를 변경하여 1.4.0을 가져올 수도 있습니다.BUILD-SNAPSHOT을 사용하려면 Spring의 스냅샷 저장소를 추가해야 합니다.
buildscript {
repositories {
maven.url "http://repo.spring.io/snapshot"
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT")
}
}
같은 스프링부트 버전 1.4.0을 사용해야 합니다.메이븐과 같은 빌드 스냅샷.SNAPSHOT org.springframework.boot.web.support.SpringBootServletInitializer
1.4.0부터 도입되었기 때문에 gradle은 찾을 수 없습니다.
org.springframework.boot.web.support.SpringBootServletInitializer
는 권장되지 않습니다.
대신 아래를 사용합니다.
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
언급URL : https://stackoverflow.com/questions/38413594/org-springframework-boot-web-support-does-not-exist
'programing' 카테고리의 다른 글
스프링 부트 기본 로그 위치 (0) | 2023.03.14 |
---|---|
네이티브 응답 오류: 요소 유형이 잘못되었습니다. 문자열 또는 클래스/함수가 필요한데: 개체를 받았습니다. (0) | 2023.03.14 |
폐지 통지:React DOM.render는 React 18에서 지원되지 않습니다. (0) | 2023.03.14 |
$postLink 각진 컴포넌트/방향성이 너무 빨리 실행됨 (0) | 2023.03.14 |
속성별 배열 정렬 (0) | 2023.03.14 |