什么是工件,Maven为什么需要它?
当前回答
Maven在项目中组织其构建。
maven中的工件是由maven项目生成的资源。每个maven项目都可以有一个工件,比如罐子、战争、耳朵等。 项目的配置文件“pom.xml”描述了如何构建工件,如何运行单元测试等等。 通常,使用maven构建的软件项目由许多maven项目组成,这些maven项目构建了构成产品的工件(例如jar)。 如。
Root-Project // produces no artifact, simply triggers the build of the other projects
App-Project // The application, that uses the libraries
Lib1-Project // A project that creates a library (jar)
Lib2-Project // Another library
Doc-Project // A project that generates the user documentation from some resources
Maven工件并不局限于java资源。你可以生成任何你需要的资源。例如文档、项目站点、zip-archives、本地库等。
Each maven project has a unique identifier consiting of [groupId, artifactId, version]. When a maven project requires resources of another project a dependency is configured in it's pom.xml using the above-mentioned identifier. Maven then automatically resolves the dependencies when a build is triggered. The artifacts of the required projects are then loaded either from the local repository, which is a simple directory in your user's home, or from other (remote) repositories specified in you pom.xml.
其他回答
在一般的软件术语中,“工件”是由软件开发过程产生的东西,无论是与软件相关的文档还是可执行文件。
在Maven术语中,工件是Maven构建的结果输出,通常是jar或war或其他可执行文件。maven中的工件由groupId、artifactId和version组成的坐标系统标识。Maven使用groupId、artifactId和version来标识构建和运行代码所需的依赖项(通常是其他jar文件)。
工件是部署到Maven存储库的文件,通常是JAR。
Maven构建生成一个或多个工件,例如编译后的JAR和“源”JAR。
每个工件都有一个组ID(通常是反向域名,如com.example.foo)、一个工件ID(只是一个名称)和一个版本字符串。三者合在一起唯一地识别了这个神器。
项目的依赖项被指定为工件。
问:maven中的Artifact是什么? 答:神器是一个罐子,(战争或耳朵),但它也可以是其他东西。每个藏物都有,
组ID(比如com.your.package); 一个工件ID(只是一个名字),以及 版本字符串。三者合在一起唯一地识别了这个神器。
问题:Maven为什么需要它们? 答:Maven用于使它们可用于我们的应用程序。
通常我们谈论Maven术语关于组Id,工件Id和快照版本
组Id:项目所属组的标识 工件Id:项目的标识 快照版本:项目使用的版本。
Artifact不过是Jar、War、Ear等结果文件....
简单地说工件只是包。
Maven在项目中组织其构建。
maven中的工件是由maven项目生成的资源。每个maven项目都可以有一个工件,比如罐子、战争、耳朵等。 项目的配置文件“pom.xml”描述了如何构建工件,如何运行单元测试等等。 通常,使用maven构建的软件项目由许多maven项目组成,这些maven项目构建了构成产品的工件(例如jar)。 如。
Root-Project // produces no artifact, simply triggers the build of the other projects
App-Project // The application, that uses the libraries
Lib1-Project // A project that creates a library (jar)
Lib2-Project // Another library
Doc-Project // A project that generates the user documentation from some resources
Maven工件并不局限于java资源。你可以生成任何你需要的资源。例如文档、项目站点、zip-archives、本地库等。
Each maven project has a unique identifier consiting of [groupId, artifactId, version]. When a maven project requires resources of another project a dependency is configured in it's pom.xml using the above-mentioned identifier. Maven then automatically resolves the dependencies when a build is triggered. The artifacts of the required projects are then loaded either from the local repository, which is a simple directory in your user's home, or from other (remote) repositories specified in you pom.xml.
推荐文章
- 在流中使用Java 8 foreach循环移动到下一项
- 访问限制:'Application'类型不是API(必需库rt.jar的限制)
- 用Java计算两个日期之间的天数
- 如何配置slf4j-simple
- 在Jar文件中运行类
- 带参数的可运行?
- 我如何得到一个字符串的前n个字符而不检查大小或出界?
- 我可以在Java中设置enum起始值吗?
- Java中的回调函数
- c#和Java中的泛型有什么不同?和模板在c++ ?
- 在Java中,流相对于循环的优势是什么?
- Jersey在未找到InjectionManagerFactory时停止工作
- 在Java流是peek真的只是调试?
- Recyclerview不调用onCreateViewHolder
- 将JSON字符串转换为HashMap