【问题标题】:IntelliJ Spring Web and MavenIntelliJ Spring Web 和 Maven
【发布时间】:2015-09-13 08:57:00
【问题描述】:

我正在尝试创建 JEE spring web 项目(+spring security、mvc、web flow),它将是一个带有 IntelliJ IDE 的 maven 项目。

我试过了:

1) 将项目创建为“Spring”,

2) 其他库和框架:Spring、Spring MVC、Spring Security、Spring Web Flow。 Web 应用程序、应用程序服务器、休眠。 然后点击完成按钮。

3) 项目创建后,右键单击“添加框架支持”并选择maven。

我有三个问题:

1) 这是使用 IntelliJ 创建 Spring Web Maven 项目的正确方法吗?

2) 项目有一个 lib 文件夹,其中包含 spring、hibernate jar 等。它们不作为依赖项包含在 pom.xml 文件中。如何按照 pom.xml 文件中的定义制作它们,以便这些 jar 文件位于“External Libraries”文件夹中?

3) 当我在创建新项目时没有选择“应用程序服务器”时,当使用“添加框架支持”创建项目时,我无法稍后添加。为什么?

提前致谢。

【问题讨论】:

    标签: spring intellij-idea spring-boot


    【解决方案1】:

    这是创建spring web maven项目的正确方法吗 IntelliJ?

    不,创建一个Maven(或Gradle)项目表单起点,然后通过Maven(或Gradle)依赖管理系统添加依赖。通常,通过lib 文件夹或System Wide Dependencies 管理依赖关系是不是好主意。 Read more on

    项目有一个 lib 文件夹,其中包含 spring、hibernate jar 等。它们是 不作为依赖项包含在 pom.xml 文件中。我怎样才能使它们成为 它们在 pom.xml 文件中定义,因此这些 jar 将位于“外部 库”文件夹?

    删除所有 jar 文件并将其替换为 pom.xml 的依赖项部分。您应该找到groupIdartifactIdversion 每一个的坐标。例如,对于 spring-core 模块,您应该将其添加到您的 <dependencies></dependencies> 部分:

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>4.2.0.RELEASE</version>
    </dependency
    

    当我在创建新时没有选择“应用程序服务器”时 项目,我以后无法添加,当使用“添加”创建项目时 框架支持”。为什么?

    创建项目后,可以通过Run &gt; Edit Configuration设置添加Application ServersServlet Containers

    【讨论】:

      猜你喜欢
      • 2017-09-10
      • 1970-01-01
      • 2015-09-09
      • 2016-10-25
      • 2019-04-15
      • 2017-08-27
      • 2017-03-23
      • 2018-10-27
      • 2021-01-03
      相关资源
      最近更新 更多