2015-04-01 24 views
0

我正在與Spring和Maven一起開發webapp,希望能夠從本地tomcat服務器和intellij內運行應用程序。這種依賴似乎是罪魁禍首。Intellij無法運行具有一定依賴性的Spring應用程序

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-tomcat</artifactId> 
    <scope>provided</scope> 
</dependency> 

當我刪除此依賴的應用程序運行在的IntelliJ很好,因爲其他的依賴,但隨後無法在Tomcat運行。

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-web</artifactId> 
</dependency> 

我可以設置一些東西來自動使用intellij的正確依賴項嗎?

回答

2

您可以在pom.xml中設置maven配置文件,然後爲Intellij使用特定的配置文件。 Intellij允許您在運行構建時選擇配置文件。

<profiles> 
<profile> 
    <id>intellij</id> 
    … 
    <dependencies> 
     <dependency>…</dependency> 
    </dependencies> 
    … 
</profile> 
<profile> 
    <id>release</id> 
    … 
    <dependencies> 
     <dependency>…</dependency> 
    </dependencies> 
    … 
</profile> 

相關問題