Springboot - Executing Fat Jar - spring-boot

I have a springboot application which creates a JAR artifact using maven build. I understand that we can execute this jar from command line by going into target folder and executing appropriate command but what I want to know that how can I export this jar to a different machine(Unix Box) and execute the jar?

Related

Not able to upload jar using mvn:deploy command

I have one jar that I want to upload into mvn artifact using mvn:deploy command.
after executing command, it is creating new jar and bundled the jar which I want to upload in artifact inside it.

Is it possible to create same ear file in maven which is generated from ant in Ant to Maven migration?

I am trying to migrate enterprise application from ant to maven. Can we generate same kind of ear file in maven which is generated from ant?
Because ant ear file has different folders in it along with group of jar and war files.Few folders contains dependency jars and one of the folder has shell scripts. How to add this folders in maven project?

Gradle Spring boot application not executeable after install/uploadArchives

I want to upload an executable jar/war to a nexus repoistory
When running a gradle build I get a 66 MB jar file containing all required libraries.
However, after running install or uploadArchives, the created jar file now only contains my code and is no long executable.
When creating a war file the only thing missing is Spring's loader package.
The above happens when running gradle tasks separately,
e.g. gradle build
or gradle install
However, if the gradle tasks are run together,
e.g. gradle build install
or gradle build uploadArchives
the executable part is not removed.

How to execute a maven goal described in a pom.xml file packaged in a jar

I have a maven project which generated a jar with its pom file inside and this jar is deployed on different environment. pretty straightfoward for the moment.
I would like to execute a goal (a liquibase:update) from this pom file using only the jar produced. Is there a way to do this automatically with maven, without extracting the files from the jar beforehand ? Something like mvn -jar myJar.jar liquibase:update
Check the answer to this question, I think it can help you:
Is there a good way to use maven to run an executable jar?

Spring Boot War

I tend to use the runnable JAR during development, but I need a WAR for deployment.
I've followed this article about converting from a JAR to WAR Spring Boot Gradle build.
However, right now, everytime I switch the builds from one to the other, I have to comment and uncomment the specific parts of the build file.
Is there a cleaner way of handling allowing for both a JAR and WAR build?
The war that gets build for deployment (that is if you added the spring-boot maven plugin) is just as runnable as a jar file.
java -jar mywar.war
And presto it starts with an embedded server, you can deploy the same war to your server and then it doesn't use an embedded server.
You can specify pom or gradle build file when you build.
So, you can create multiple pom files (one for jar packaging, the other for war packaging) for maven builds, also do same for gradle builds.
For example, if you setup pom.xml or build.gradle file for jar packaging and also setup pomWar.xml or buildWar.gradle for war packaging, then you can run below command
[ build jar packaging by maven ]
$ mvn clean install
[ build jar packaging by gradle ]
$ gradle clean test bootRepackage
[ build war packaging by maven ]
$ mvn -f pomWar.xml clean install
[ build war packaging by gradle ]
$ gradle -b buildWar.gradle clean test bootRepackage
war file can't be dependency of other project. so if you has other project has dependency on your spring boot project, then that is the case where you want to setup two different build files like above on your build machine

Resources