Generating and building a compilation artifact

In Modelio, you can now create a compilation artifact representing the jar file, simply by clicking on the “Create Java Designer element\Compilation artifact” command, in the context menu.

A deployment diagram is automatically created below the compilation artifact, in order to create a manifestation link to packages to be embedded within your jar file. Note that you can create packages with long names, as in the example shown in the figure below.

On this artifact, you can launch various commands, as shown in the figure below.

Key:

  • ../java_images/jar_icon1.gif: The “Generate” command will generate Java code for all the elements manifested by the artifact.

  • : The “Update model if necessary” command will reverse the Java code for all the elements manifested by the artifact.

  • ../java_images/jar_icon2.gif: The “Generate Ant file” command will generate the build.xml file in the Java workspace directory, to compile manifested elements.

  • ../java_images/jar_icon3.gif: The “Compile” command will launch the compilation by executing the ANT target “build”, to create .class files from your generated Java files.

  • : 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.

  • run: The “Run application” command is used to run a generated and compiled application from an ANT file.

The following table details predefined targets:

NameLabel
InitInitialize the environment.
CleanDelete all files produced by the compilation.
ResourceManage resource files.
BuildCompile the project.
ArchiveCreate the jar file.
RMIUse rmic on corresponding classes.
JavahUse Javah on corresponding classes.

Note: You can specify that a jar file requires another jar file by creating a Usage 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.

By default, the Jar file produced by the generated ANT file is created in the path defined by the “Execution path” Java Designer 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 compilation artifact in question.

generate.png (608 Bytes) admin admin, 15 December 2014 10:22

run.png (1.36 KB) admin admin, 15 December 2014 10:22

fig8.png (23 KB) admin admin, 15 December 2014 10:22

fig7.png (8.98 KB) admin admin, 15 December 2014 10:22

build.png (642 Bytes) admin admin, 15 December 2014 10:22

update.png (1.27 KB) admin admin, 15 December 2014 10:22

ant.png (515 Bytes) admin admin, 15 December 2014 10:22

target.png (487 Bytes) admin admin, 15 December 2014 10:22