Upload jar file to Artifactory or Nexus repository using Gradle and Maven publish

Sometime we end up with a situation when we have a jar file as dependency of our project and that jar file is not in our artifact repository. This makes difficulties to include this file into our gradle or maven project. Thanks to maven-publish plugin which help us to easily deploy the jar to our private Artifactory or Nexus repository. Here is a sample gradle file to demonstrate that.

Spark Java file upload example

In this post we will see how to upload a multipart file using Spark Java. We will have a HTML frontend where user will select a file from his/her system. Then pressing the “Upload” button the file will be posted as multipart data to server. In the server side, the multipart file will be fetched and saved to a defined directory. Using Spark Java, we can achieve this by writing just few lines of code.