Java中的pom.xml文件有什么用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19681558/
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
What is the use of pom.xml file in Java?
提问by Raj
What is the main feature of a POM file and why is it actually used?
POM 文件的主要功能是什么,为什么实际使用它?
How will the dependencies get mapped to the Java virtual machine whatever we give in it and become flexible on application?
无论我们提供什么,依赖项如何映射到 Java 虚拟机并在应用程序上变得灵活?
采纳答案by Little Child
A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects. Examples for this is the build directory, which is target; the source directory, which is src/main/java; the test source directory, which is src/main/test; and so on.
The POM was renamed from project.xml in Maven 1 to pom.xml in Maven 2. Instead of having a maven.xml file that contains the goals that can be executed, the goals or plugins are now configured in the pom.xml. When executing a task or goal, Maven looks for the POM in the current directory. It reads the POM, gets the needed configuration information, then executes the goal.
项目对象模型或 POM 是 Maven 中的基本工作单元。它是一个 XML 文件,其中包含有关 Maven 用于构建项目的项目和配置详细信息的信息。它包含大多数项目的默认值。这方面的例子是构建目录,它是目标;源目录,即 src/main/java;测试源目录,即 src/main/test;等等。
POM 从 Maven 1 中的 project.xml 重命名为 Maven 2 中的 pom.xml。不再有包含可以执行的目标的 maven.xml 文件,现在在 pom.xml 中配置目标或插件。执行任务或目标时,Maven 会在当前目录中查找 POM。它读取 POM,获取所需的配置信息,然后执行目标。
Source: Official Documentation
来源:官方文档
回答by Ruchira Gayan Ranaweera
It is not a java
file. It is maven
configuration file.
它不是一个java
文件。它是maven
配置文件。
What is a POM?
什么是 POM?
A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. Read more.
项目对象模型或 POM 是 Maven 中的基本工作单元。它是一个 XML 文件,其中包含有关 Maven 用于构建项目的项目和配置详细信息的信息。阅读更多。