简体   繁体   English

IntelliJ Spring Web和Maven

[英]IntelliJ Spring Web and Maven

I am trying a create JEE spring web project (+spring security, mvc, web flow) and it will be a maven project with IntelliJ IDE. 我正在尝试创建JEE spring Web项目(+ spring security,mvc,web flow),它将是带有IntelliJ IDE的maven项目。

I tried : 我试过了 :

1) Create Project as "Spring", 1)创建项目为“ Spring”,

2) Additional Libraries and frameworks : Spring, Spring MVC, Spring Security, Spring Web Flow. 2)其他库和框架:Spring,Spring MVC,Spring Security,Spring Web Flow。 Web Application, Application Server, Hibernate. Web应用程序,应用程序服务器,休眠。 And click on Finish button. 然后单击完成按钮。

3) After project created, right clicked and "Add frameworks support" and selected maven. 3)创建项目后,右键单击并单击“添加框架支持”,然后选择maven。

I have three questions : 我有三个问题:

1) Is this a right approach to create a spring web maven project with IntelliJ? 1)这是使用IntelliJ创建spring web maven项目的正确方法吗?

2) Project has a lib folder that has spring, hibernate jars etc. They are not included in pom.xml file as dependency. 2)项目有一个lib文件夹,其中包含spring,hibernate jars等。它们不作为依赖项包含在pom.xml文件中。 How can i make them as they defined in pom.xml file so these jars will be in "External Libraries" folder? 我怎样才能使它们像在pom.xml文件中定义的那样,以便这些罐子位于“外部库”文件夹中?

3) When i didn't select "Application Server" while creating a new project, I cannot add later, when the project is created using "Add frameworks support". 3)当我在创建新项目时未选择“应用服务器”时,使用“添加框架支持”创建项目时,以后将无法添加。 Why? 为什么?

Thanks in advance. 提前致谢。

Is this a right approach to create a spring web maven project with IntelliJ? 这是使用IntelliJ创建spring web maven项目的正确方法吗?

No, create a Maven (or Gradle ) project form starting point and then add dependencies through Maven (or Gradle ) dependency management system. 不,创建一个Maven (或Gradle )项目表单起点,然后通过Maven (或Gradle )依赖性管理系统添加依赖性。 Generally, managing dependencies through lib folders or System Wide Dependencies are NOT good ideas. 通常,通过lib文件夹或System Wide Dependencies管理依赖项不是一个好主意。 Read more on 阅读更多

Project has a lib folder that has spring, hibernate jars etc. They are not included in pom.xml file as dependency. Project有一个lib文件夹,其中包含spring,hibernate jar等。它们不作为依赖项包含在pom.xml文件中。 How can i make them as they defined in pom.xml file so these jars will be in "External Libraries" folder? 我怎样才能使它们像在pom.xml文件中定义的那样,以便这些罐子位于“外部库”文件夹中?

Delete all jar files and replace them with dependency section of pom.xml . 删除所有jar文件,并将其替换为pom.xml dependency部分。 You should find groupId , artifactId and version coordiantes of each one. 您应该找到每个组的groupIdartifactIdversion coordiantes。 For example, for spring-core module, you should add this to your <dependencies></dependencies> section: 例如,对于spring-core模块,应将其添加到<dependencies></dependencies>部分:

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

When i didn't select "Application Server" while creating a new project, I cannot add later, when the project is created using "Add frameworks support". 当我在创建新项目时未选择“应用服务器”时,使用“添加框架支持”创建项目时,以后将无法添加。 Why? 为什么?

After creating project, you can add Application Servers or Servlet Containers through Run > Edit Configuration settings. 创建项目后,可以通过Run > Edit Configuration设置添加Application ServersServlet Containers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM