Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How can I deliver Java Maven project to client ?

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All ,

Currently am developing a java application uses pom.xml to get maven dependency for some libs and also other referenced libraries - which located at my hard disk.

How can I deliver my application to the client ?
I need to know how all this libs will be referenced at his machine and how the program can run.

Note : It is valid to install any software needed at my client machine though I need to minimize this as possible.

Thanks in advance
 
Marshal
Posts: 5326
324
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you run a "mvn clean install" you are asking Maven to create a jar file that contains all your project code, files, and dependencies. So you would deliver the jar to the client which comes with everything already packaged in it.
 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:When you run a "mvn clean install" you are asking Maven to create a jar file that contains all your project code, files, and dependencies. So you would deliver the jar to the client which comes with everything already packaged in it.



Am using Maven plugin for eclipse luna - really I can't find maven options explicitly but it sees any new dependency which is fine.

But where this generated jar file located so I can collect it ?
 
Saloon Keeper
Posts: 25466
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:When you run a "mvn clean install" you are asking Maven to create a jar file that contains all your project code, files, and dependencies. So you would deliver the jar to the client which comes with everything already packaged in it.



I believe that is incorrect. Unless I'm mistaken, "mvn install" constructs the product and installs the product (jar, war, ear, or whatever) along with supporting pom dependency information into the local Maven repository. But does not copy any source code or other files from outside the project's "target" directory.

I know that a lot of public projects do include source code, since I've used the Maven source pull option. But there may be some other target that handles that. I'd have to RTFM. I've only used that feature to make source available for debugger use (where the source archive remains unzipped in the Maven repo). I've never used it to actually build.

Normally when I deliver a maven project to a client, I just do a "mvn clean" followed by a zip-and-ship of the cleaned project directory. If my project is self-contained (and ideally it is), that's all the recipient needs. All the source code is in the ZIPped project and a maven build will reconstruct the cleaned-out files, giving an environment identical to the one I work with.

I've done that many times.
 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really am little confused now as I didn't get what exactly I need to do to deliver this application !

I tried to get below image indicate my project structure.



Kindly check it and provide your feedback.
 
Saloon Keeper
Posts: 13868
314
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm thinking you guys are referring to the "mvn package" phase. This automatically happens when you perform the "mvn install" phase (don't quote me on this though), but if you run the former instead, you will forego installing the package in the local repo.

Your project folder will contain a dist folder that contains the final build of the project. If you want to include sources and javadoc, you can use the maven-source-plugin and the maven-javadoc-plugin to attach these to your build.


Sorry, disregard all of this. It has no bearing on the question, and I was mistaken about the dist folder.

Ramy, you can use the maven-jar-plugin to provide your application with a manifest that will make it runnable, and you can use the maven-assembly-plugin to create a zip file containing your build and its dependencies.
 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dears Stephan ,

Thanks for your response.

Maven install generated to me testArtifict-0.0.1-SNAPSHOT.jar , Is it enough for me to go with it to my client and run it there ?
Since I can't find any reference to my external jars used - different than jars at pom.xml.
 
Ranch Hand
Posts: 102
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could test it yourself - copy the jar over to a different machine and see if it works. You will want to do that sort of testing before you go in front of a client
 
Stephan van Hulst
Saloon Keeper
Posts: 13868
314
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on a runnable example. I'll have it for you in a bit.
 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stuie Clarky wrote:You could test it yourself - copy the jar over to a different machine and see if it works. You will want to do that sort of testing before you go in front of a client



The application working correctly when I run it from eclispe - run as java application.

But I tried this generated jar (testArtifict-0.0.1-SNAPSHOT.jar) at target folder after mvn install.
It doesn't work when I tried to run it on my machine !!
It throws java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook

That is why I sent to ask if I have missed any thing , since only this jar file seems not enough.
 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:I'm working on a runnable example. I'll have it for you in a bit.



Thanks Stephan.
I will wait for it.
 
Stephan van Hulst
Saloon Keeper
Posts: 13868
314
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Stephan van Hulst
Saloon Keeper
Posts: 13868
314
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
src/assembly/complete.xml

 
Stephan van Hulst
Saloon Keeper
Posts: 13868
314
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The above POM and assembly descriptor will result in a zip file that contains your application, its dependencies, sources, javadocs and site. The application is executable, and only requires that its dependencies are in the lib folder underneath it.

If you don't want to include sources or other files, you can just delete the relevant fileSet from the assembly descriptor (or make a different descriptor with a different id).
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic