首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Intellij无法运行具有特定依赖关系的Spring应用程序

问Intellij无法运行具有特定依赖关系的Spring应用程序
EN

Stack Overflow用户
提问于 2015-04-01 17:54:48
回答 1查看 385关注 0票数 0

我正在使用spring和maven开发一个webapp,希望能够在本地tomcat服务器和intellij中运行应用程序。这种依赖似乎是罪魁祸首。

代码语言:javascript
复制
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

当我移除这个依赖项时,由于另一个依赖项,应用程序在intellij中运行良好,但是不能在tomcat上运行。

代码语言:javascript
复制
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

我可以设置一些东西来自动使用intellij的正确依赖项吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-01 18:06:20

您可以在pom.xml中设置maven配置文件,然后为Intellij使用特定的配置文件。Intellij允许您在运行构建时选择配置文件。

代码语言:javascript
复制
<profiles>
 <profile>
    <id>intellij</id>
    …
    <dependencies>
        <dependency>…</dependency>
    </dependencies>
    …
 </profile>
 <profile>
    <id>release</id>
    …
    <dependencies>
        <dependency>…</dependency>
    </dependencies>
    …
 </profile>

​

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29397550

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档