Search code examples
javamavenbuildartifact

Would a jar file be considered an artifact in Java?


Currently I'm learning Maven and upon studying it I have encountered the following definition on Wikipedia:

In software development, a build is the process of converting source code files into standalone software artifact(s) that can be run on a computer, or the result of doing so.

I would assume in Java the standalone artifact would be the jar file since it is the by-product from the compiled source code and it can be run standalone. However I'm not entirely sure if this would be the case.


Solution

  • When trying to understand terminology, Wikipedia is only ever a secondary source.

    The Apache Maven Glossary says:

    Artifact: An artifact is something that is either produced or used by a project. Examples of artifacts produced by Maven for a project include: JARs, source and binary distributions, WARs. Each artifact is identified by a group id, an artifact ID, a version, an extension and a classifier (extension+classifier may be named by a type).

    (There may be a more definitive source than this. If someone can find it, please comment.)

    So, yes, a JAR is an example of an artifact according to Maven terminology.

    Note that the JAR doesn't need to have been produced by Maven to be an artifact in the sense that Maven uses the concept. You can take a JAR file that was produced by (say) running the jar command by hand, and then ascribe it artifact coordinates by adding it to your local repo.