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


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

您的留言將使用 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )


連結到 %s


%d 位部落客按了讚: