什么是工件,Maven为什么需要它?


当前回答

对于maven,构建过程被安排为一组工件。产品包括:

组成Maven本身的插件。 代码所依赖的依赖项。 构建生成的任何东西都可能被其他东西消耗。

工件存在于存储库中。

其他回答

Usually, when you create a Java project you want to use functionalities made in another Java projects. For example, if your project wants to send one email you dont need to create all the necessary code for doing that. You can bring a java library that does the most part of the work. Maven is a building tool that will help you in several tasks. One of those tasks is to bring these external dependencies or artifacts to your project in an automatic way ( only with some configuration in a XML file ). Of course Maven has more details but, for your question this is enough. And, of course too, Maven can build your project as an artifact (usually a jar file ) that can be used or imported in other projects.

这个网站上有几篇关于Maven的文章:

https://connected2know.com/programming/what-is-maven/

https://connected2know.com/programming/maven-configuration/

工件是一个JAR或存储在存储库中的东西。Maven将它们取出并构建您的代码。

在一般的软件术语中,“工件”是由软件开发过程产生的东西,无论是与软件相关的文档还是可执行文件。

在Maven术语中,工件是Maven构建的结果输出,通常是jar或war或其他可执行文件。maven中的工件由groupId、artifactId和version组成的坐标系统标识。Maven使用groupId、artifactId和version来标识构建和运行代码所需的依赖项(通常是其他jar文件)。

通常我们谈论Maven术语关于组Id,工件Id和快照版本

组Id:项目所属组的标识 工件Id:项目的标识 快照版本:项目使用的版本。

Artifact不过是Jar、War、Ear等结果文件....

简单地说工件只是包。

对于maven,构建过程被安排为一组工件。产品包括:

组成Maven本身的插件。 代码所依赖的依赖项。 构建生成的任何东西都可能被其他东西消耗。

工件存在于存储库中。