concept artifact in category ant

appears as: artifacts, rtifacts, artifact, n artifact, The artifact
Ant in Action

This is an excerpt from Manning's book Ant in Action.

  • HTTP publishing of the artifacts— The build tests that the uploaded files are on a Web server by downloading them.
  • The output is a brief summary of actions: what configurations there are, how many artifacts are depended upon, and how many files were downloaded. In this run everything was in the cache; if an artifact was not there, here’s where it would be downloaded.

    11.4.1. Sharing artifacts between projects

    The <publish> task will copy the artifacts of a project to the repository identified by a named resolver, here the “local” resolver:

    <target name="ivy-publish" depends="sign-jar,ivy-init">
      <ivy:publish resolver="local" pubrevision="${project.version}"
        overwrite="true"
        artifactspattern="${dist.dir}/[artifact]-[revision].[ext]"/>
    </target>

    This resolver is bound to a repository in ${user.home}/.ivy/local. All builds by the same user have access to the repository, unless their ivyconf.xml files say otherwise. Because it’s shared by all of the user’s projects, all the user’s builds can retrieve the artifacts published to it.

    The task requires a version number for the files, which is set with the pubrevision attribute. In our builds, we’ve been numbering all artifacts, but Ivy doesn’t require this. You can create artifacts with simple names and have their revision number tacked on when the file is published. This is useful when retrofitting Ivy to an existing project. Ivy’s <ivy:buildnumber> task can even determine a build number from a repository, by determining the version number of the latest artifact in the repository and setting an Ant property to that value plus one.

    With our build files already using version numbers, we avoid that step. We do have to tell Ivy how to locate the files, which is where the artifactspattern attribute comes in. It contains a directory path and a pattern for finding artifacts. The pattern [artifact]-[revision].[ext] says that artifacts are created with the pattern of name-revision and the expected extension. Unnumbered artifacts would need the simpler pattern [artifact].[ext]. What we don’t do is list the actual files that are created. This seems surprising, but it’s because the ivy.xml file declared the artifact already in its <publications> element:

    <publications>
      <artifact conf="master"/>
    </publications>

    This element declares that an artifact is published in the “master” configuration only. The artifact’s name defaults to that of the module, and it also has the default extension/type of JAR. Projects can create artifacts with different names or extensions. In chapter 14, for example, we’ll create the EAR file diary.ear: