Project

General

Profile

How to download jars from Z2 » History » Version 8

Henning Blohm, 18.06.2023 18:09

1 4 Henning Blohm
h1. How to download jars from Z2
2 1 Henning Blohm
3 5 Henning Blohm
In most everyday operations you do not need to think about binary build results when using the Z2 environment. In some cases however you need to have compiled binaries at hand. Most notably this is the case when you want to implement test automation for unit tests and z2Unit (see also [[how to z2unit]]).
4 1 Henning Blohm
5 7 Henning Blohm
Using the "com.zfabrik.dev.util/jarRetriever":http://www.z2-environment.net/javadoc/com.zfabrik.dev.util!2Fjava/impl/com/zfabrik/impl/dev/JarRetriever.html tool you can request binaries of a set of Java components including dependencies. This tool is an example of a Main program running using an embedded Z2 environment (see also "MainRunner":http://www.z2-environment.net/javadoc/com.zfabrik.core.api!2Fjava/api/com/zfabrik/launch/MainRunner.html and [[Current_Reference#The-z2-Command-Line-the-Embedded-Runtime-and-the-Main-Runner|The Embedded Runtime and the Main-Runner]]. That is, in order to run it you do *not* need a Z2 server running. You do however need a Z2 home installation.
6 5 Henning Blohm
7 6 Henning Blohm
When run from the command line, say at a z2 home install, you would run something like this (replace placeholders):
8
9
<pre><code>
10 8 Henning Blohm
java -Dcom.zfabrik.home=. -DcomponentName=com.zfabrik.dev.util/jarRetriever -jar bin/z.jar -out <out folder> <components>
11 6 Henning Blohm
12
</code></pre>
13
14
15 5 Henning Blohm
One particular use case is to retrieve Jars from Z2 within an ANT script to run unit tests.
16
17
The following snippet is an example on how to retrieve all jars, including dependencies for some components from Z2:
18
19
<pre>
20
<code class="xml">
21
<java classpath="${z2home}/run/bin/z_embedded.jar" classname="com.zfabrik.launch.MainRunner" fork="true">
22
    <!-- general config -->
23
    <sysproperty key="java.util.logging.config.file" value="logging.properties" />
24
    <sysproperty key="com.zfabrik.home" value="${z2home}" />
25
    <sysproperty key="com.zfabrik.mode" value="development" />
26
    <sysproperty key="componentName" value="com.zfabrik.dev.util/jarRetriever" />
27
    <!-- output folder -->
28
    <arg line="-out ${output}" />
29
    <!-- project to retrieve binaries from -->
30
    <arg line="${components}" />
31
</java>
32
</code></pre>
33
34
In this example the following properties are expected:
35
36
|${output}|The folder to store the retrieved jar files|
37
|${components}|A blank-separated list of components to retrieve the jars from|
38
|${z2home}|The installation folder of the Z2 home that is being used to load the jar files from|