VideosAnt Support


Duration: 07:38
This video demonstration will guide you through the process of creating, editing, and running an Ant build file.


00:00:07This video demonstration will guide you through the process of creating, editing and running
00:00:13an Ant build file.
00:00:15Using oXygen XML Editor we'll benefit from features like validation, content completion
00:00:21assistant, search and refactoring actions, and Master Files support.
00:00:27Our project contains a small company's human resource information. All personnel data is
00:00:33stored in several XML files.
00:00:36Our goal is to use this information to create a small personnel presentation webpage.
00:00:40We previously created the XSLT stylesheets needed to generate the HTML output.
00:00:47Also, the project contains additional resources like CSS files, images and some static HTML
00:00:55We'll use an Ant build file instead a plain XSL transformation because:
00:01:00- our web project needs to have a certain directory structure
00:01:03- it depends on some additional resources that need to be copied in the deliverable
00:01:09- the personnel-related content needs to be dynamically generated depending on the available
00:01:16information supplied by the HR department.
00:01:18Editing the build file will use the content completion assistant and validation features.
00:01:28We'll create a new Ant build file... and save it as "build_html.xml".
00:01:45We'll name our project "personnelWebpage".
00:01:47Now we'll have to create an entry point in our build file which is the target executed
00:01:51by default, when no other target name is supplied to the launcher.
00:01:55This is done by specifying a value for the "default" attribute.
00:02:00The automatic validation kicks in letting us know that the build file is invalid, because
00:02:05the specified target does not exist.
00:02:07We declare an extension point with this name...
00:02:18Now the file is valid and the error is gone.
00:02:21To make the project more flexible, we'll declare some properties to refer the resources we'll
00:02:26use in our build from now on.
00:02:29First we'll set the output directory property ...
00:02:35Note that when the Content Completion Assistant is active, a short description is presented
00:02:40for the currently selected item in the list.
00:02:46Similarly, we'll declare other properties.
00:03:00The first Ant target in our build ensures a clean output directory.
00:03:05It will delete the content generated by previous runs of the build.
00:03:09We'll name our target "clean".
00:03:12We'll delete and recreate the output directory to prepare the environment for the rest of
00:03:17the tasks the build will perform.
00:03:19Inside the target element, the CC Assistant proposes the list of all available Ant tasks
00:03:26and types.
00:03:27This includes the built-in tasks and types, as well as the custom ones.
00:03:32Since we want to delete the output directory, we choose the "delete" task...
00:03:37The Content Completion Assistant also provides the list of available property names.
00:03:41This includes the properties defined earlier, as well as the system properties currently
00:03:46set in the Java Virtual Machine.
00:03:48Let's recreate the output directory structure.
00:03:52The next step is to copy the additional resources in the output directory...
00:04:02This target depends on previously created one.
00:04:06Now, let's copy the CSS files... ... then the images...
00:04:12followed by the additional html files.
00:04:17Similarly we write targets that generate the TOC and the HTML pages for each person in
00:04:23the company.
00:04:27Now we completed the individual steps of the build process.
00:04:31All we need now is to tie them together.
00:04:34Returning to the entry point in our build file, namely the "generate-html" extension
00:04:38point, we'll add the previously defined targets to its "depends" list.
00:04:45Once again the CC Assistant helps us to add the target names to this list.
00:05:05Once we completed writing the Ant script, we review it.
00:05:08Since we are not happy with the names of some of the components, we decide to modify them.
00:05:13Let's take, for instance, the "out.dir" property.
00:05:17To ensure the build script consistency, we need to modify all occurrences of this property.
00:05:23To quickly find out where this property is used, we just click the property name and
00:05:28oXygen highlights all its occurrences in the current file.
00:05:31Next, we'll invoke the "Rename Component" action available in the Quick Assist menu.
00:05:37Note that all occurrences are decorated with a thin border, indicating that the in-place
00:05:42editing mode has been activated.
00:05:44This means that all the changes you make to the component at caret position are updated
00:05:49in real time to all component's occurrences.
00:05:52Now we will edit the property name....
00:05:54... and then press Enter to commit the changes.
00:06:02Now we are happy with the current form of the build file and we are ready to test it.
00:06:07oXygen comes with a predefined transformation scenario that allows us to run Ant builds.
00:06:12We'll use the default settings to execute our build file.
00:06:15In the Results area oXygen displays the execution log.
00:06:19The build was successful, so we'll check the output.
00:06:22Back to the Project view and refresh the output directory.
00:06:34We open the index.html file in a web browser.
00:06:54The Outline View displays the list of all the components (properties, targets and references)
00:07:00defined in the current Ant build file or in the imported or included files.
00:07:06The components can be grouped by their location, which is the Ant build file they were collected
00:07:11from... and by their type.
00:07:15The components displayed in the Outline View benefit from the entire set of search and
00:07:19refactoring actions.
00:07:21Moreover we can switch to the classic node-structured Outline View using the "Show XML Structure"
00:07:28action available in the Settings menu.
00:07:34And this concludes our demonstration.
00:07:36Thanks for watching.

Use Oxygen Feedback to ask us anything about this video.