internet-sicherheit / ethereum-cache-creator

GNU General Public License v3.0
0 stars 0 forks source link

Build an publish executable artifact as JAR #12

Closed kiview closed 4 years ago

kiview commented 4 years ago

We need to publish an easily usable JAR of the project, so people can use the program without running from source code.

This roughly includes 3 tasks:

For building the fat JAR, using the maven-assembly-plugin is probably the way to go.

Mschnuff commented 4 years ago

gui pushed to moritz_test_branch. this was long overdue

kiview commented 4 years ago

I unchecked the second task, since this is not done.

kiview commented 4 years ago

Using the JavaFX plugin, we can very easily build a custom Java runtime image with Maven and jlink: https://openjfx.io/openjfx-docs/

We need to investigate how well this will work if we want to support GUI as well as a headless mode for the tool. There are some specific things to keep in mind though:

When building the runtime image, we will use Java9 style module-path instead of the classpath. So we have to set up the build accordingly and also find out how to correctly testing Java modules. This blog post should be helpful.

Mschnuff commented 4 years ago
mvn exec:java  -Dexec.mainClass=de.internetsicherheit.brl.bloxberg.cache.gui.MainGUI -Dexec.args="arg1 arg2 arg3"
Mschnuff commented 4 years ago

Is it customary to have a fixed order for the parameters? I could reserve 1 argument for starting the program with a gui. worked fine during testing.

kiview commented 4 years ago

In general, I'd argue it is much better to have named arguments instead of positional arguments, although it depends on the use case. A combination is also possible, including sane defaults and override via named arguments.

So what about:

$ java -jar cache-creator.jar --ui=gui --url=bloxberg.com 0 10000

Just as a rough idea, does not need to be exactly like this.

kiview commented 4 years ago

Sadly, using the module system makes things in general unnecessarily complicated, especially with regards to testing. I, therefore, prefer using the classpath and fatJAR approach as our firs step.

On the other hand, building a fatJAR seems to fail because of this: https://stackoverflow.com/questions/34855649/invalid-signature-file-digest-for-manifest-main-attributes-exception-while-tryin

Mschnuff commented 4 years ago

ok I will not use arguments with identifiers in the way that you showed including using defaults. I will not use any specific order at this point.