Maven-ant-task use of notebooks

Source: Internet
Author: User
Tags cdata mkdir
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} "/&Gt;          <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= "&lt;meta http-equiv= ' content-type ' content= ' text/html; Charset=utf-8 '/&gt; ' >              <doctitle>                   <! [Cdata[

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.