Search code examples
mavenartifact

What is an Artifact?


Recently I came across with the term 'artifact' in related to maven build tool...

Can someone please explain what it's meant by 'artifact' in software industry and specifically in maven.


Solution

  • Maven organizes it's build in projects.
    An artifact in maven is a resource generated by a maven project. Each maven project can have exactly one artifact like a jar, war, ear, etc.
    The project's configuration file "pom.xml" describes how the artifact is build, how unit tests are run, etc. Commonly a software project build with maven consists of many maven-projects that build artifacts (e.g. jars) that constitute the product.
    E.g.

    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 artifacts are not limited to java resources. You can generate whatever resource you need. E.g. documentation, project-site, zip-archives, native-libraries, etc.