You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2003/04/20 14:43:10 UTC

cvs commit: maven/xdocs/ant-guide design.xml

dion        2003/04/20 05:43:10

  Modified:    xdocs/ant-guide design.xml
  Log:
  Some stuff on design of Maven vs Ant
  
  Revision  Changes    Path
  1.2       +86 -19    maven/xdocs/ant-guide/design.xml
  
  Index: design.xml
  ===================================================================
  RCS file: /home/cvs/maven/xdocs/ant-guide/design.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- design.xml	5 Oct 2002 13:22:56 -0000	1.1
  +++ design.xml	20 Apr 2003 12:43:10 -0000	1.2
  @@ -1,19 +1,86 @@
  -<?xml version="1.0"?>
  -
  -<document>
  -
  -  <properties>
  -    <title>Maven</title>
  -    <author email="maven@walding.com">Ben Walding</author>
  -  </properties>
  -
  -  <body>
  -    <section name="Overview">
  -      <p>
  -        This section covers the design of Maven in relation to
  -        where it improves on Ant / where it is weaker than Ant.
  -      </p>
  -    </section>
  -  </body>
  -  
  -</document>
  +<?xml version="1.0"?>
  +
  +<document>
  +
  +  <properties>
  +    <title>Maven</title>
  +    <author email="maven@walding.com">Ben Walding</author>
  +    <author email="dion@apacheorg">dIon Gillard</author>
  +  </properties>
  +
  +  <body>
  +    <section name="Overview">
  +      <p>
  +        One of the fundamental differences between Ant and Maven is in
  +        whose responsibility it is to understand the build process and the
  +        tools used therein.
  +      </p>
  +      <p>
  +        With Ant, it's the developer who must understand what the tool is
  +        and how it applies to their development. With Maven, build process 
  +        knowledge is captured in <code>plugins</code>, small snippets of
  +        processing that rely on you providing some information.
  +      </p>
  +      <subsection name="An example">
  +        <p>
  +          To compile your java code using Ant, you must first
  +          write a build.xml file which uses Ant's <a href="http://ant.apache.org/manual/CoreTasks/javac.html">javac</a>
  +          task, passing that task the correct set of parameters.
  +        </p>
  +        <source><![CDATA[
  +...
  +<!-- compile Java source files -->
  +<target name="compile">
  +	<javac
  +		srcdir="./src;./test"
  +		destdir="./bin"
  +		debug="on"
  +		optimize="off">
  +		
  +		<classpath>
  +			<fileset dir="lib" includes="*.jar"/>
  +		</classpath>
  +	</javac>
  +</target>
  +...
  +]]>
  +        </source>
  +        <p>
  +          You'd then call this build.xml file using ant from the command prompt
  +        </p>
  +        <source>ant compile</source>
  +        <p>
  +          This isn't too hard to do, and as you move from project to project you
  +          become better at this, and understand Ant better, learning what each
  +          of the options is for and what the best way to write these snippets is.
  +        </p>
  +        <p>
  +          Maven, however, takes a far more declarative approach. You must
  +          provide Maven with some information about your project (in a file called
  +          project.xml), one piece of which is your source directory 
  +          that stores your java code.
  +        </p>
  +        <source><![CDATA[
  +...
  +  <build>
  +    <sourceDirectory>src/java</sourceDirectory>
  +    <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
  +...
  +]]>
  +        </source>
  +        <p>
  +          To compile your code, you just need to specify that you have a
  +          <code>sourceDirectory</code> and then ask maven to compile using
  +        </p>
  +        <source>maven java:compile</source>
  +        <p>
  +          There's no need for the developer to understand how to write a plugin
  +          to use one. And several plugins can share the same information. For example
  +          the plugin that checks source code conforms to a coding standard uses
  +          the same <code>sourceDirectory</code> as the plugin that compiles code.
  +        </p>
  +      </subsection>
  +    </section>
  +  </body>
  +  
  +</document>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org