Skip to content

Commit 3b59a26

Browse files
author
mdaraujo19
committed
Added new custom parameters to GenerateDistributableCommand, formatting and bug fixes
1 parent 5d18f78 commit 3b59a26

File tree

62 files changed

+1569
-1019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1569
-1019
lines changed

README.md

Lines changed: 193 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,194 @@
1-
# Java to Distributable
1+
# Packaging and Use guide for Java To Distributable
22

3-
Some utilities to generate GNU/Linux distributable files from Java sources.
3+
This is a guide that explains how to obtain the `.jar` file and later, how use the Java to Distributable app.
4+
5+
## Before starting
6+
7+
There are some **requirements** (tools and programs) that are needed for the success of this processes, which are:
8+
9+
- Have **Maven** installed.
10+
- Have **Java 11 SE** installed and configured.
11+
- Have access to the **dpkg**, **rpm**, **rpmbuild**, **snapcraft** and **snap** commands, as well as being on a GNU/Linux operating system.
12+
- Recommended to have the **latests version of the Java to Distributable** project.
13+
14+
If you already meet this requirements, you are free to continue.
15+
16+
## Packaging
17+
18+
This section is all about packaging process. It will provide some insights and guidelines on how to obtain the `.jar` executable file for the Java To Distributable app.
19+
20+
The steps are rather simple:
21+
22+
1. First, open a command prompt.
23+
2. Now, navigate to the project's root folder.
24+
3. Finally, execute the following command:
25+
26+
```
27+
user@machine:~$ mvn clean package
28+
```
29+
30+
After all the process is completed, you should be left with all the produced files on the “*target*” folder of the project.
31+
32+
This includes the `.jar` executables of the Java To Distributable app.
33+
34+
## Use guide
35+
36+
This section provides a use guide for the Java To Distributable app.
37+
38+
As the previous section, the use of the app is very simple:
39+
40+
1. Open a command prompt.
41+
2. Now, you can use the app as follows:
42+
43+
```
44+
user@machine:~$ java -jar <path_to_your_desired_jar> COMMAND [ARGS…]
45+
```
46+
47+
It is recommended that you use the “*jar-with-dependencies-and-services*” so you can use all the features of the application without problems.
48+
49+
You can see more about the Java To Distributable commands and options in the “*Example_Java_To_Distributable_commands.md*” file.
50+
51+
## Choices.xml file
52+
The `choices.xml` file is a user provided `XML` for package info overwrite.
53+
Its format is simple. All of its elements are optional, can be in any order, and all hang from the **root** `<choice>` element. But there are a few **exceptions** to the latter, such as the `<jarPath>`, `<dependency>`, `<category>`, and `<javaRunArg>` elements that hang from the `<jarPaths>`, `<dependencies>`, `<categories>`, and `<javaRunArgs>` tags respectively.
54+
55+
The tags that can be placed in the `choices.xml` file are:
56+
57+
- `<targetCommandName>` represents the name of the command with which the application is executed.
58+
- `<name>` represents the full name of the application.
59+
- `<version>` represents the current version of the application.
60+
- `<description>` represents the description of the application.
61+
- `<className>` represents the fully qualified main Java class of the application.
62+
- `<licence>` represents the licence of the application.
63+
- `<documentation>` represents the homepage URL of the application.
64+
- `<maintainer>` represents the maintainer of the application.
65+
- `<icon>` represents the application's icon path.
66+
- `<terminal>` represents whether or not the application run on a terminal.
67+
- `<base>` represents the pre-built runtime environment upon which the snap will run.
68+
- `<grade>` represents whether the snap is considered a stable release or a development version.
69+
- `<confinement>` represents the degree of confinement applied to the snap.
70+
- `<javaDependency>` represents the Java package that the application needs to be executed.
71+
- `<manPage>` represents the man page file path of the application.
72+
- `<categories>` represents/contains a set of `<category>`
73+
- `<category>` represents a category for the distributable file to be tagged as such.
74+
- `<dependencies>` represents/contains a set of `<dependency>`
75+
- `<dependency>` represents a package dependency for the distributable file.
76+
- `<jarPaths>` represents/contains a set of `<jarPath>`
77+
- `<jarPath>` represents the path of a `.jar` file.
78+
- `<javaRunArgs>` represents/contains a set of `<javaRunArg>`
79+
- `<javaRunArg>` represents a Java execution argument to run the application with.
80+
81+
## Result
82+
83+
The execution of a command produces a **distributable** file.
84+
85+
### Debian package (.deb)
86+
87+
In the case that you chose to generate a `.deb` distributable file, you can follow this steps to install the application on your Debian distribution:
88+
89+
1. Open a command prompt.
90+
2. You can install the `.deb` file using the following command in your terminal:
91+
92+
```
93+
user@machine:~$ sudo dpkg -i <path_to_the_distributable_file>
94+
```
95+
Note that you must have **sudo** privileges to execute the previous command.
96+
97+
If its **required to install some additional packages**, the tool will ask for your permission.
98+
99+
3. Once the application is installed, you can use with the following command:
100+
101+
```
102+
user@machine:~$ <package_name>
103+
```
104+
Where the package name is the one that is in the first part of the `.deb` package name, for instance:
105+
106+
```
107+
seda_1.6.0-SNAPSHOT_all.deb -> <package_name>_<version>_<architecture>.deb
108+
```
109+
4. If you want to **uninstall** the application, you can simply execute the next command:
110+
111+
```
112+
user@machine:~$ sudo dpkg -r <package_name>
113+
```
114+
115+
### Snapcraft package (.snap)
116+
117+
In the case that you chose to generate a `.snap` distributable file, you can follow this steps to install the application on your Linux distribution:
118+
119+
1. Open a command prompt.
120+
2. You can install the application by executing the following command in your terminal:
121+
122+
```
123+
user@machine:~$ sudo snap install --dangerous <path_to_the_distributable_file>
124+
```
125+
The "dangerous" flag is necessary because the generated snapcraft package is not signed, so you need to indicate that you know about that fact.
126+
127+
Also, if the generated snapcraft package was created with a confinement other than **strict**, you should add another flag, for example:
128+
129+
```
130+
user@machine:~$ sudo snap install --dangerous --devmode <path_to_the_distributable_file>
131+
```
132+
133+
```
134+
user@machine:~$ sudo snap install --dangerous --classic <path_to_the_distributable_file>
135+
```
136+
137+
If the confinement is **devmode** or **classic** respectively.
138+
139+
Note that you must have **sudo** privileges to execute the previous command.
140+
141+
If its **required to install some additional packages**, the tool will ask for your permission.
142+
143+
3. Once the application is installed, you can use with the following command:
144+
145+
```
146+
user@machine:~$ <package_name>
147+
```
148+
149+
Where the package name is the one that is in the first part of the `.snap` package name, for instance:
150+
151+
```
152+
seda_1.6.0-SNAPSHOT_amd64.snap -> <package_name>_<version>_<architecture>.snap
153+
```
154+
4. If you want to **uninstall** the application, you can simply execute the following command:
155+
156+
```
157+
user@machine:~$ sudo snap remove <package_name>
158+
159+
```
160+
161+
### Red Hat Package Manager (.rpm)
162+
In the case that you chose to generate a .rpm distributable file, you can follow this steps to install the application on your Red Hat based distribution:
163+
164+
1. Open a command prompt.
165+
2. Navigate to the root of the output folder that you choose when generating the distributable file.
166+
3. Now, go to `rpmbuild/RPMS/noarch`, it is where the `.rpm` file is stored.
167+
4. To install it, execute this command:
168+
169+
```
170+
user@machine:~$ sudo rpm -i <package_name>
171+
```
172+
Note that you must have **sudo** privileges to execute the previous command.
173+
174+
If its **required to install some additional packages**, the tool will ask for your permission.
175+
176+
177+
5. Once the application is installed, you can use with the following command:
178+
179+
```
180+
user@machine:~$ <package_name>
181+
```
182+
183+
Where the package name is the one that is in the first part of the `.rpm` package name, for instance:
184+
185+
```
186+
seda-1.6.0_SNAPSHOT-1.el7.noarch.rpm -> <package_name>-<version>-<package_version>.<linux_enterprise_version>.<architecture>.rpm
187+
```
188+
189+
6. If you want to **uninstall** the application, you can simply execute the following command:
190+
191+
```
192+
user@machine:~$ sudo rpm -e <package_name>
193+
194+
```

0 commit comments

Comments
 (0)