Java Build Tool course in 2011

  • Published on
    26-Aug-2014

  • View
    623

  • Download
    6

Embed Size (px)

DESCRIPTION

 

Transcript

  • Java Build ToolsJava Build Tools Ant & MavenAnt & Maven 2011, qrtt12011, qrtt1
  • IDE Java Compiler
  • Top Down Bottom Up
  • Top Down Top Down Bottom Up
  • IDE Java Compiler CLASSPATH Script Linux Shell Script Windows .BAT
  • Build Tool Developer OR Build Server check out build document library application auto testing Build Tool Version Control commit
  • Build Tool
  • Build Tool Ant Maven Java Build Tool
  • Ant Apache Ant http://ant.apache.org Java XML
  • Why Ant JVM Java build tool Linux GNU Make Windows NMake Windows SDK CLASSPATH Windows ; Linux : Shell/DOS rm del Write once, run anywhere JVM + Bytecode Java
  • Ant Ant Ant XML Ant API
  • Ant build file = 1 Build Script Task Task Task Task Task Task
  • Ant Ant Ant Task http://ant.apache.org/manual/ CheatSheet ( ) Task IDE Eclipse NetBeans Build Script
  • Ant Ant Tasks
  • Ant Task Javac
  • Ant Task
  • Ant Task
  • Ant Task Task
  • Ant In Daily AntInDaily ConfigurationManager
  • Ant In Daily ConfigurationManager config.properties getDatabaseInfo() DatabaseInfo
  • Ant In Daily config dev prod dev prod
  • Ant In Daily IDE .class
  • Ant In Daily IDE
  • Ant In Daily IDE Library UI Library Ant Fat JAR
  • Ant Build Script In Eclipse Eclipse Ant Editor Ant In Daily MyProject Ant Build Script Ant
  • Build Script for Ant build.xml Ant Script File build.xml Eclipse build.xml Ant Script Editor Build Script
  • Build Script for Ant (Content Assist) Edit Content Assist Alt + / Ctrl + Space Eclipse Ctrl + Space Alt + / ( )
  • Build Script for Ant
  • Build Script for Ant
  • Build Script for Ant
  • Build Script for Ant Run Ant Script from Eclipse build.xml Run Ant Build C:workspace2MyProjectbuild.xml:8: destination directory "C:workspace2MyProjectbuild" does not exist or is not a directory
  • Build Script for Ant build
  • Build Script for Ant
  • Build Process src Ant Script IDE .java Ant Ant
  • Prepare Environment Compile Source Code Copy Resources Prepare Test Environment Compile Test Source Code Copy Test Resources Generate Document Generate Report Generate Library Release Library Deploy Library Execute App Build Process
  • Prepare Environment Compile Source Code Copy Resources Prepare Test Environment Compile Test Source Code Copy Test Resources Generate Document Generate Report Generate Library Release Library Deploy Library Execute App Build Process mkdir copy javac mkdir copy javac junitjavadoc jar war ftp ftp copy java exec
  • Script For AntInDaily XML Tag Attribute
  • Script For AntInDaily
  • Script For AntInDaily prepare compile package clean default
  • Script For AntInDaily Prepare dev/prod
  • Script For AntInDaily Compile Ant java CLASSPATH
  • Script For AntInDaily Package JAR
  • Script For AntInDaily Clean
  • Ant Property & DataType Project Target Task Ant Script Property DataType Ant
  • Ant Property Property property ant -Dfoo.library=my_foo_library.jar
  • Ant - DataType Ant classpath classpath
  • http://ant.apache.org/manual/Types/fileset.html
  • CLASSPATH javac cp .;Foo.jar;Bar.jar ..
  • AntInDaily build.xml build.xml path reference classpath path reference Lab1 JDK 6.0 Lab 1 AntInDaily build.xml
  • Lab 1 AntInDaily build.xml build.xml classpath ${lib.dir} JARs
  • Lab 1 AntInDaily build.xml path reference
  • Ant Ant Task Library Ant Ant Task API Task IDE Plugin taskdef Task classpath
  • Ant taskdef classpath JAR ${user.home}/.ant/lib ${ant.home}/lib CLASSPATH Ant JARs JAR classpath ( javac )
  • Ant CheckStyle CheckStyle Ant Task Build Process
  • Lab 2 Ant CheckStyle Task CheckStyle Task path reference CheckStyle JAR check Target CheckStyle check Target CheckStyle Task Task Lab2
  • Lab2 lib.build Build Tool JARs path reference classpath.build Lab 2 Ant CheckStyle Task
  • path reference Lab 2 Ant CheckStyle Task
  • check Target checkstyle Task path reference Lab 2 Ant CheckStyle Task
  • IDE Ant IDE Ant Script IDE Ant Ant IDE Run As Ant Build Click Ant View Button
  • IDE Ant Ant Ant Ex. C:appapache-ant-1.8.2 ANT_HOME= C:appapache-ant-1.8.2 PATH %ANT_HOME%bin
  • IDE Ant Ant
  • IDE Ant Ant IDE
  • IDE Ant IDE Ant Build Script IDE Ant IDE Ant
  • IDE Ant Ant IDE Ant Java Ant CLASSPATH Ant Linux Shell Script Windows .Bat Ant .Bat Ant Script .Bat Windows
  • Maven Maven Ant Build Script Build Tool
  • Maven ${basedir} src main java resource test java resource target classes
  • Maven Build Phase install package test deploy site Ant Target
  • Maven Maven Build lifecycle Default Build Lifecycle Phase mvn package mvn package Lifecycle Phase package validate initialize generate-sources process-sources generate-resources process-resources compile process-classes generate-test-sources process-test-sources generate-test-resources process-test-resources test-compile process-test-classes test prepare-package package pre-integration-test integration-test post-integration-test verify mvn package
  • validate initialize generate-sources process-sources generate-resources process-resources compile process-classes generate-test-sources process-test-sources generate-test-resources process-test-resources test-compile process-test-classes test prepare-package package pre-integration-test integration-test post-integration-test verify install deploy mvn package resources:resource compiler:compile resources:testResource compiler:testCompile surefire:test jar:jar install:install deploy:deploy Bind Phase To Plugins Goal
  • Maven Plugin Maven Plugin Ant Task Maven Plugin Maven Compiler Plugin org.apache.maven.plugins:maven-compiler-plugin org.apache.maven.plugins Group ID maven-compiler-plugin Artifact ID Maven GroupID:ArtifactID
  • Maven Plugin Maven GroupID:ArtifactID Maven Repository Maven Plugin URL Maven Plugin
  • Maven Dependency Management Maven pom.xml Plugin 4.0.0maven.labhello.maven0.0.1-SNAPSHOTjarhello.mavenhttp://maven.apache.orgUTF-8junitjunit3.8.1test
  • Maven Dependency Management Maven Plugin Maven junit:junit Repository http://repo1.maven.org/maven2/junit/junit/ junitjunit3.8.1test
  • Maven In Eclipse Build Tool Maven Maven Maven Maven m2eclipse plugin Eclipse Maven
  • m2eclipse m2eclipse update site http://m2eclipse.sonatype.org/sites/m2e
  • m2eclipse
  • m2eclipse
  • m2eclipse
  • m2eclipse
  • Maven Command Tool Maven Ant m2eclipse Maven Command Tool http://maven.apache.org/ maven C:app
  • Maven Command Tool maven bin PATH EX. C:appapache-maven-3.0.3bin
  • Maven Command Tool m2eclipse Maven
  • Maven Project m2eclipse Eclipse Maven Project
  • Maven Project
  • Maven Project maven-archetype-quickstart
  • Maven Project Maven Project groupId artificatId version
  • Maven Project
  • Maven Project Maven
  • IDE Maven Maven
  • Maven POM View
  • Maven POM Editor
  • Maven Maven Project
  • Maven Maven Project Maven Project Maven Project Maven Project
  • Maven Repository Central Repository Super POM Repository Local Repository .m2 Private Repository Maven Repository Repository
  • Lab 3 Maven Repository Maven Repository Jetty Server(jetty-distribution-7.3.0.v20110203.zip) Nexus War Nexus Repository Jetty Server Web Server Nexus(nexus-webapp-1.9.0.2.war) Nexus Web Server Servlet/JSP Container Tomcat Jetty
  • Jetty Server java -jar start.jar Lab 3 Maven Repository
  • http://localhost:8080 Lab 3 Maven Repository
  • Nexus Repository nexus-webapp-1.9.0.2.war nexus.war nexus.war Jetty webapps http://localhost:8080/nexus Lab 3 Maven Repository
  • Nexus Repository Nexus admin admin123 Lab 3 Maven Repository
  • Nexus Repository Administrator Server Default HTTP Proxy Settings Lab 3 Maven Repository
  • Jetty Server Servlet/JSP Container Nexus Repository Proxy Nexus IP Nexus Repository Lab 3 Maven Repository
  • Lab 4 Maven Maven Maven Private Repository Maven Configuration ${MAVEN}/conf/settings.xml pom.xml Maven Private Repository Deploy phase
  • Maven Private Repository settings.xml m2eclipse External Maven open file XML Editor Lab 4 Maven
  • nexuscentralhttp://centraltruetruecentralhttp://centraltruetrue Lab 4 Maven
  • nexus*http://localhost:8080/nexus/content/groups/publicnexus Lab 4 Maven
  • Maven Global Configuration settings.xml profile repository plugin repository id...