java spring 3.1 maven 依赖项和 pom.xml

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15528583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 19:56:53  来源:igfitidea点击:

spring 3.1 maven dependencies and pom.xml

javaspringmavenspring-mvcpom.xml

提问by Human Being

I am new to spring .In my office I am first one to use spring framework.So there is no guidance for me.So kindly excuse if it is a simple question. so please don't hesitate to edit my question.

我是春天的新手。在我的办公室里,我是第一个使用的人spring framework。所以没有给我的指导。所以如果这是一个简单的问题,请原谅。所以请不要犹豫,编辑我的问题。

Right now I created the simple employee management MVC applicationto do register,deleteand login employee detatilswith spring 3.0. Now willing to move spring 3.1

现在我创建了简单的employee management MVC applicationto do registerdeletelogin employee detatils使用spring 3.0. 现在愿意搬家spring 3.1

Today I heared about some wordings in spring likeMaven,pom.xml.

今天我听说了一些春天的用语,比如Mavenpom.xml

In my application I never used the maven dependenciesand pom.xml.I don't know where to use it and when it is needed.

在我的应用程序中,我从未使用过maven dependenciespom.xml。我不知道在哪里使用它以及何时需要它。

I googled a lot and never find the reliable answer about those things.

我在谷歌上搜索了很多,但从未找到关于这些事情的可靠答案。

Can any one tell me what is mavenin spring ? when it is used and where to use it ? Also what about the pom.xml.

谁能告诉我maven春天是什么?何时使用以及在何处使用?还有pom.xml.

Good answers are definitely appreciated.

好的答案绝对值得赞赏。

回答by Xavi López

Mavenhas nothing to do with Spring. It is a project build tool that provides a lot of functionalities such as dependency management, compiling, packaging, unit testing and much more. You could see it as kind of an ant/makefileon steroids.

Maven与 Spring 无关。它是一个项目构建工具,提供了许多功能,例如依赖项管理、编译、打包、单元测试等等。您可以将其视为类固醇上的一种蚂蚁/生成文件

The pom.xml, or Project Object Modelfile is the descriptor for mavenizedprojects (that is, projects meant to be built with Maven). In this pom.xmlfile is where you would specify, among many other things, dependencies to Spring, without the need of adding anything to the CLASSPATH.

pom.xml,或项目对象模型文件是描述符Maven化项目(也就是意味着使用Maven构建项目)。在此pom.xml文件中,您可以指定对 Spring 的依赖,而不需要在CLASSPATH.

For instance, with Maven properly installed, you could just define this dependency in your pom.xml:

例如,在正确安装 Maven 的情况下,您可以在您的pom.xml

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

And just compile your Spring project with mvn compilewithout adding anything to the classpath. Maven would download every needed dependencies' jars from online repositories. The getting startedguide on Maven's site can be a good resource to start with.

只需编译您的 Spring 项目,mvn compile无需在类路径中添加任何内容。Maven 将从在线存储库中下载所有需要的依赖项的 jar。Maven 站点上的入门指南可能是一个很好的入门资源。

回答by SudoRahul

In short:-

简而言之:-

Mavenis a tool that can be used for building and managing any Java-based project.

Maven是一种可用于构建和管理任何基于 Java 的项目的工具。

pom.xmlis an XML file that contains information about the project and configuration details used by Maven to build the project.

pom.xml是一个 XML 文件,其中包含有关 Maven 用于构建项目的项目和配置详细信息的信息。

For complete details, refer the docs. Maven, pom.xml

有关完整的详细信息,请参阅文档。Maven, pom.xml