0

I am trying to generate an executable jar for a project called "mysas" using maven, just like this:

How can I create an executable JAR with dependencies using Maven?

I added the snippet shown there to the pom.xml, and ran mvn clean install. It generates two jar files in mysas/target: mysas-0.1.0.jar, and mysas-0.1.0-jar-with-dependencies.jar.

I need to test and run this file on a remote machine but mysas-0.1.0-jar-with-dependencies.jar is around 500 MB

I don't want to move this big file every time I make a small change. Is there a way that I can transfer dependencies only once separately, and use mysas-0.1.0.jar for testing my changes.

Community
  • 1
  • 1
Count
  • 1,395
  • 2
  • 19
  • 40

3 Answers3

0

You can package needed dependent jars using maven assembly plugin and while executing the application make sure that these jars are on classpath

jay5
  • 37
  • 2
  • Thanks , that's I am aware but how can I extract all the jars at the first place . there are around 40 jars, going to m2 folder identify each and then copy will be a pain too – Count Mar 17 '15 at 10:06
0

One possible solution is to use Appassembler plugin to package your application. Then, you can transfer entire bundle once and then update only your jar (without dependencies) for each build.

0

I have found a solution, Below are the steps

  1. Extract the jar on remote machine
  2. Maven clean install on local machine
  3. Copy and replace the classes what you have change from local to remote machine
  4. Create a Jar on server using below command on remote and use the jar

    jar -cvf 
    
Count
  • 1,395
  • 2
  • 19
  • 40