Benx Blog

七月 2, 2014

Diigo Diary 07/02/2014

Filed under: Diigo Diary — benxshen @ 8:30 上午
    • Running mvn install from the command line will process resources, compile source, execute unit tests, create a JAR, and install the JAR in a local repository for reuse in other projects.
    • you can run mvn site and then find an index.html file in target/site that contains links to JavaDoc and a few reports about your source code.
    • Maven POMs contain declarations: “This is a JAR project", and “The source code is in src/main/java“. Ant build files contain explicit instructions: “This is project", “The source is in src/main/java“, “Run javac against this directory", “Put the results in target/classes“, “Create a JAR from the ….", etc. Where Ant had to be explicit about the process, there was something “built-in" to Maven that just knew where the source code was and how it should be processed.
      • Apache Ant  

         

         
         
           
        •  Ant doesn’t have formal conventions like a common project  directory structure or default behavior. You have to tell Ant  exactly where to find the source and where to put the  output. Informal conventions have emerged over time, but they  haven’t been codified into the product. 
        •  

        •  Ant is procedural. You have to tell Ant exactly what to do and  when to do it. You have to tell it to compile, then copy, then  compress. 
        •  

        •  Ant doesn’t have a lifecycle. You have to define goals and goal  dependencies. You have to attach a sequence of tasks to each goal  manually. 
        •  

         

         

         

           Apache Maven  

         

         
         
           
        •  Maven has conventions. It knows where your source code is because  you followed the convention. Maven’s Compiler plugin put the  bytecode in target/classes, and it produces a JAR file in  target. 
        •  

        •  Maven is declarative. All you had to do was create a pom.xml  file and put your source in the default directory. Maven took  care of the rest. 
        •  

        •  Maven has a lifecycle which was invoked when you executed mvn  install. This command told Maven to execute a series of  sequential lifecycle phases until it reached the install  lifecycle phase. As a side-effect of this journey through the  lifecycle, Maven executed a number of default plugin goals which  did things like compile and create a JAR. 
    • The decision to use Maven or Ant isn’t a binary one, and Ant still has a place in a complex build. If your current build contains some highly customized process, or if you’ve written some Ant scripts to complete a specific process in a specific way that cannot be adapted to the Maven standards, you can still use these scripts with Maven. Ant is made available as a core Maven plugin.
    • Maven is more of a platform than a tool

Posted from Diigo. The rest of my favorite links are here.

發表迴響 »

仍無迴響。

RSS feed for comments on this post. TrackBack URI

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

在 WordPress.com 建立免費網站或網誌.

%d 位部落客按了讚: