Build Scripts

  • Published on
    29-Nov-2014

  • View
    86

  • Download
    3

Embed Size (px)

DESCRIPTION

Sutt kynning "Build scripts" me ANT

Transcript

  • 1. Build Scripts Reading: Ant article
  • 2. Why Build Scripts? For large enterprise systems using the IDE is not sufficient for building Complicated Builds Automatic Nightly Builds Special Build Machines Important to be able to separate build and development
  • 3. What is Ant? ANT is a tool to build programs make tool Uses XML file to describe the solution Default file is build.xml Uses Java classes to run tasks Built-in tasks Jakarta project http://ant.apache.org Current version 1.8.2 Installation guidelines are on the course web
  • 4. Ant in use Command Prompt Verkefni> Verkefni build.xml src/ ant Buildfile: build.xml ... Project classes/ dist/ ANT file Source Class files JAR file Project>ant BUILD SUCCESSFUL Total time: 4 seconds
  • 5. Running Ant Usage ant [options] [target [target2 [target3] ...]] Target can be selected Default is used if target is not specifed Examples >ant -buildfile test.xml >ant -buildfile test.xml dist >ant -buildfile test.xml -Dbuild=build/classes dist
  • 6. Using Ant Each build file is one project (one output) Build file is XML file (for example build.xml) Project has Name Default target Basedir One or more target Target Target is a collection of tasks Task depend on other tasks default="dist" basedir="."> ...
  • 7. Using Ant Properties Have names and values Referenced with ${property} Example: target>
  • 8. Example build.xml file Import Contents Process
  • 9. Structure Work space build.xml src/java contains the Java files src/msg contains resource bundles lib/ - contains libraries (jar files) Ant made directories classes/ - compiled Java files class files dist/ - distributable - jar files JAR file dist/ImportContentProcess.jar
  • 10. build.xml
  • 11. build.xml
  • 12. Building C:hrHonn>ant Buildfile: build.xml init: [mkdir] Created dir: C:hrHonnclasses compile: [javac] Compiling 11 source files to C:hrHonnclasses jar: [jar] Building jar: C:hrHonndistImportContentProcess.jar BUILD SUCCESSFUL Total time: 2 seconds C:hrHonn>java -cp libcommons-logging.jar;libjdom.jar;librome-0.8.jar;libruf ramework.jar;libspring.jar;distImportContentProcess.jar is.ruframework.process.RuProcessRunner
  • 13. Using Ant with IntelliJ Most IDEs support ANT Must use the same folders IntelliJ has ANT support Easy to use Ant is powerful when using IntelliJ to develop container-based programs For example EJBs, Web Apps