Generating and building an ANT file

 

In Objecteering, you can now create an artifact stereotyped <<jarFile>> representing the jar file, simply by clicking on the button in the toolbar. From this artifact, you can then create a manifestation link to packages embedded within your jar file. Note that you can create packages with long names, as in the example shown in Figure 88 below.

 

Figure 88. Creating an artifact stereotyped <<jarFile>> to represent the jar file

 

On this artifact, you can launch various commands, as shown in Figure 89.

 

Figure 89. The commands available on an artifact stereotyped <<jarFile>>

 

·         The "Generate ant file" command will generate the build.xml file in the Java genroot directory, to compile manifested elements.

·         The "Build ant file" command will launch the compilation by executing the ANT target “build”, to create .class files from your generated Java files. The result is displayed in the Objecteering console.

·         The "Execute ant target" command will open a window to present all the targets defined in the ANT file, so that you can select the target that is to be launched.  The result is displayed in the Objecteering console.

·         The "Run application" command is used to run a generated and compiled application from an ANT file.

 

The following screenshot shows the icons available in the "Java" tab of the properties editor on an artifact stereotyped <<jarFile>>.

 

Figure 89-b. The icons available on an artifact stereotyped <<jarFile>> in the "Java" tab of the properties editor

 

Icon

Description

This icon is used to generate Java code for all the elements manifested by the artifact.

This icon is used to generated the build.xml file in the Java genroot directory, to compile manifested elements.

This icon is used to launch compilation by executing the ANT target "build", to create .class files from your generated Java files.  The result is displayed in the Objecteering console.

This icon is used to view the generated documentation.

This icon is used to open a window to present all the targets defined in the ANT file, so that you can select the target that is to be launched.  The result is displayed in the Objecteering console.

This icon is used to run a generated and compiled application from an ANT file.

 

 

 

 

The following list details predefined targets:

The … target

Is used to…

Init

Initialize the environment.

Clean

Delete all files produces by the compilation.

Resource

Manage resource files.

Build

Compile the project.

Archive

Create the jar file.

RMI

Use rmic on corresponding classes.

Javah

Use javah on corresponding classes.

 

Note:      You can specify that a jar file requires another jar file by creating a use link between them.

 

 

Customizing the location of generated ANT and Jar files

ANT files are generated according to the artifacts that represent them in the model. By default, the ant file is generated in the compilation path using the name of the artifact followed by ".xml". It is possible to specify an alternative path using a tagged value available on artifacts.  This path must be absolute and must contain the ANT file name.  $(GenRoot) can be used in the specified path to designate the generation root defined in the Objecteering UML Modeler options.

 

By default, the Jar file produced by the generated ANT file is created in the path defined by the "Jar File directory" Java Developer parameter using the name of the artifact followed by ".jar". This path can be modified at parameter level. Each Jar file can be produced with a different name and directory by using the "FileName" field found in the edition box of the <<JarFile>> artifact in question. This path must be absolute and must contain the JAR file name. $(GenRoot) can be used in the specified path to designate the generation root defined in the Objecteering UML Modeler options.