Maven-ant-task use of notebooks
Blog Category:The dependency management of Java maven Ant XML maven is indeed a good thing. But Ant is obviously better in terms of integrated builds. Today I tried the tool maven-ant-task, it feels very good. Maven dependencies can be invoked in ant
First you need to define the Maven-ant-task, and Maven's POM path
XML code <!--using MAVEN2 dependency Management--<path id= "Maven-ant-tasks.classpath" path= "Lib/maven-ant-tasks-2.0.8.jar"/> <typedef resource= "Org/apache/maven/artifact/ant/antlib.xml" uri= "urn:maven-artifact-ant" classpathref= "Mave N-ant-tasks.classpath "/> <!--definition Maven2 variable--<artifact:pom id=" Maven.project "file=" Pom.xml "/> <art Ifact:dependencies pathid= "Maven.classpath" filesetid= "Maven.fileset" > <pom refid= "Maven.project"/> & Lt;/artifact:dependencies>
<!--use Maven2 dependency Management--
<path id= "Maven-ant-tasks.classpath"
path= "Lib/maven-ant-tasks-2.0.8.jar"/ >
<typedef resource= "Org/apache/maven/artifact/ant/antlib.xml"
uri= "Urn:maven-artifact-ant
" classpathref= "Maven-ant-tasks.classpath"/>
<!--definition Maven2 variables--
<artifact:pom id= " Maven.project "file=" Pom.xml "/>
<artifact:dependencies pathid=" Maven.classpath "
filesetid=" Maven.fileset ">
<pom refid=" Maven.project "/>
</artifact:dependencies>
Use the previously defined classpath at compile time
XML code <javac srcdir= "${SRC}" destdir= "${build.classes}" classpathref= "Maven.classpath"/>
<javac srcdir= "${src}" destdir= "${build.classes}"
classpathref= "Maven.classpath"/>
A complete build.xml.
XML code <?xml version= "1.0" encoding= "UTF-8"?> <project name= "elitemark-commons" default= "Build" & nbsp; xmlns:artifact= "Urn:maven-artifact-ant" > <description> Elitemark Lightweight Commons api</description> <property file= " Build.properties "/> <target name=" clean " description= "cleans up the build artifacts and temporary directories" > & nbsp; <delete dir= "${dist}"/> <delete dir= "${ build.classes} "/> <delete dir=" ${build.test} "/> <delete dir= "${build.javadoc}"/> </ target> <target name= "Init" > <!--use Maven2 dependency management--> <path id= " Maven-ant-tasks.classpath " path=" lib/ Maven-ant-tasks-2.0.8.jar "/> <typedef resource=" Org/apache /maven/artifact/ant/antlib.xml " uri=" Urn:maven-artifact-ant " classpathref=" Maven-ant-tasks.classpath "/> <!--define MAVEN2 variables-- <artifact:pom id= "Maven.project" file= "Pom.xml"/> <artifact:dependencies pathid= "Maven.classpath" filesetid= "Maven.fileset" > <pom refid= "Maven.project"/> </artifact:dependencies> </target> <target name= "compile" depends= "init" > <mkdir dir= "${build.classes}"/> <javac srcdir= "${src}" Destdir= "${build.classes}" classpathref = "Maven.classpath"/> <copy todir= "${build.classes}" Includeemptydirs= "No" > <fileset Dir= "${res}" > <include name= "**/*"/> </fileset> </copy> </ target> <target name= "Jar-all" > <mkdir dir= "${dist}"/> <delete file= "${dist}/${ Artifactid}-${version}.jar " FailOnError = "false"/> <jar destfile= "${dist}/${artifactid}-${version} . Jar " basedir=" ${build.classes} " encoding= "UTF-8" > <manifest> <attribute Name= "Implementation-title" &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBsp; value= "${app.name}"/> <attribute name= "implementation-version" Value= "${versionnumber}"/> <attribute name= "Implementation-vendor" value= "${vendor}"/> </manifest> </jar> </target> <target Name= "Javadoc" depends= "init" > <mkdir dir= "${build.javadoc} "/≫ <javadoc packagenames= "org.elitemark.commons.*" sourcepath= "${src}" defaultexcludes= "Yes" Destdir= "${build.javadoc}" author= "true "Version=" true "use=" true "windowtitle=" ${app.name} " classpathref= "Maven.classpath" encoding= "UTF-8" docencoding= "UTF-8" header= "<meta http-equiv= ' content-type ' content= ' text/html; Charset=utf-8 '/> ' > <doctitle> <! [Cdata[