Nas*_*din 15 java web-services war spring-boot
我试图将弹簧启动应用程序打包为战争.根据这个,我修改了应用程序类:
@SpringBootApplication
@EntityScan({"org.mdacc.rists.cghub.model"})
@EnableJpaRepositories(basePackages = {"org.mdacc.rists.cghub.ws.repository"})
public class Application extends SpringBootServletInitializer
{
public static void main( String[] args )
{
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
Run Code Online (Sandbox Code Playgroud)
还在我的pom.xml中添加了以下内容
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
当我打包项目时,我收到以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project cg-web: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
当我阅读spring boot应用程序时,我从未见过有关创建web.xml的任何内容.将Spring启动应用程序部署为战争需要web.xml吗?
Ali*_*der 22
根据这个答案,Maven通过将以下代码段添加到您的pom.xml来忽略web.xml缺席:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
28004 次 |
最近记录: |