IDEA
springboot jar包改成war包不是隻把pom.xml的jar改成war就好了的
- pom.xml中
<packaging>war</packaging>
- 添加tomcat以及servlet依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>compile</scope>
</dependency>
- 實現SpringBootServletInitializer,重寫configure()方法
@SpringBootApplication
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);
}
}
Maven
maven install失敗的可能原因以及解決辦法
- 沒有配置maven環境變量,IDE可能會引用錯誤的maven版本
解決辦法:配置maven環境變量
- IDEA沒有設置全局maven配置,再新打開工程的時候默認使用了IDEA的maven
解決辦法:
- 需要install的項目被其他ftp上傳工具打開,引起了maven保護
解決辦法:關閉ftp連接
- maven引用衝突了
解決辦法:刪除本地資源庫,重新install
- IDEA內部出問題
解決辦法:關閉IDEA重開
WebStorm
npm
cpnm i可能引起引用結構混亂,可以使用cpnm install --by=num替代
npm run build失敗的可能原因
- package.json中的"query-string"版本爲6.x,會導致build失敗
解決辦法:修改"query-string"的引用版本
"query-string": "^6.x.x" -----> "query-string": "^5.0.1"