Q:

Using Maven ant task to install jar to local repository

At the end of my ant build id like it to call the equivalent of the command line call
mvn install:install-file -Dfile=my.jar -DgroupId=com.company.project -DartifactId=my_project -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

so that it will add the newly built jar to a maven repository which another project will rely on.  
Ive tried using the maven-ant-task and have added the maven-ant-task jar to the ant built project and the following code to the build.xml:
<target name ="minstall" depends="jar">
  <artifact:pom id="maven_install" file="maven_install.xml" />
  <artifact:install file="${out.dir}/my_project.jar">
      <pom refid="maven_install"/>
  </artifact:install> 
</target>

but seem to be missing something as it wont work for me.  To begin with i get the error in the build.xml (ant build file) saying 
The prefix "artifact" for element "artifact:pom" is not bound.
What am I doing wrong.  I am fairly new to ant?
On a realted question what is the purpose of the associated POM file?  I would not normally have a POM in this project as it is an ant build

A:

Perhaps maven-ant-task jar is not installed, i.e. not in your ant CLASSPATH.  You can follow this instruction for this.

A:

As mentioned previously, you need to make sure the tasks are defined in your ant script, and the artifact namespace is understood.
The POM file is used (in this case) to tell the Maven repositories the dependencies of the JAR you are putting in the repository. The POM should also specify the JAR's identification information (groupId, artifactId, version number, license, etc.).
Strictly speaking, you do not need an external POM, you could define the information in your build.xml file as follows:
<!-- Assuming tasks defined, and 'artifact' namespace exists -->
<artifact:pom id="maven_install" groupId="com.whatever" artifactId="some-jar"
              version="1.0" packaging="jar">
    <dependency groupId="..." artifactId="..." version="..."/>
    <dependency groupId="..." artifactId="..." version="..."/>
    <license name="apache" url="http://www.apache.org"/> <!-- can be omitted -->
</artifact:pom>

<target name ="minstall" depends="jar">
    <artifact:install file="${out.dir}/my_project.jar" pomRefId="maven_install"/>
</target>

When you install the JAR in the 'minstall' task, the POM should be generated with the appropriate dependencies in the local Repository.

