Java, Compiling, Maven, other
Maven Intro
-
I went through a maven example using this git repo on Ubuntu 16.04 https://github.com/LableOrg/java-maven-junit-helloworld
- Just clone the repo and go to directory where pom.xml is located
- To compile
mvn compile - To run compiled stuff
mvn exec:java -Dexec.mainClass="com.example.javamavenjunithelloworld.Hello"
mvn exec:java -Dexec.mainClass="com.example.javamavenjunithelloworld.HelloApp"
JAVA building running and all other devops stuff
JAR
- jar basics
- JAR OVERALL WIKI DESCRIPTION
- WHAT IS CONTAINED IN JAR
- https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html
- https://stackoverflow.com/questions/1238145/how-to-run-a-jar-file
- HOW TO PASS ARGUMENTS TO JAR
- JAR-id es dependency management - Basically there are aree 2 alternatives
- Fat jars - which already include all dependencys
- Not fat jars - dependencys should be specified at runtime
- how to EXCLUDE logj4 from jar - how everything
RUNTIME dependency management (assuming maven)
- I created a fat jar from project and a non-fat jar (-> THE part which i modify). This allows me to have a very quickly packaged part for my own source code which has all the dependencys easily set out using maven. This solution comes from the fact that simply downloading all the jars using command:
mvn dependency:copy-dependenciesdid not work likely due to some library ordering issuexs.
- thus I this example pom for fat jar creation which I next included in my thin jars. The thin jars were built without adding extra libras like the second code snippet will show ~~~
+ thin jar
~~~
- I also had some issues when creating fat jars using the shaders plugin. Solution is available here as the second answer