Could you give me a detail explanation about the difference between jar and jar-no-fork goal?
I see it from official site, but I can not get a clear idea for this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
My interpretation: the
jargoal is meant to be run from the command line (mvn source:jar), thejar-no-forkis meant to be bound to the lifecycle.If you look at the docs for the
jargoal the key phrase is “Invokes the execution of the lifecycle phase generate-sources prior to executing itself.” If you configure your POM to run thesource:jargoal as part of the lifecycle, Maven will re-run all of the goals bound togenerate-sourcesand its predecessors. If you have many plugin goals bound to the validate or initialize phases all of those will run twice, lengthening the time of your build.In contrast,
jar-no-forkis what you attach to the build lifecycle because it expects to be bound to a phase somewhere aftergenerate-sourcesand will not run the bound goals again.I have verified this behavior by running Maven 3 with
-Xand reviewing the plugin executions that run.