Include dependency jars in the resources
Hi, I am new to Maven so, please help me out with the solution. I have set up a Java project and the pom creates a jar out of it. It has 5 dependency jars which are in my repository and the project refers to it fine (M2_REPO) These external jars are being placed under src directory but are not packaged with jar. I want to include these external jars in my jar. (Do not want to place each jar in resource manually) How do you tell pom.xml to include dependency jars in resources of the jar? Regards, Divya Arun Fidelity India This e-mail, including any attachment(s) hereto, is intended only for the individual or entity to whom it is addressed. It may contain proprietary, confidential or privileged information or attorney work product belonging to Fidelity Business Services India Pvt. Ltd. (FBS India) or its affiliates. If you are not the intended recipient of this e-mail, or if you have otherwise received this e-mail in error, please immediately notify the sender via return e-mail and permanently delete the original mail, any print outs and any copies, including any attachments. Any dissemination, distribution, alteration or copying of this e-mail is strictly prohibited. The originator of this e-mail does not guarantee the security of this message and will not be responsible for any damages arising from any dissemination, distribution, alteration or copying of this message and/or any attachments to this message by a third party or as a result of any virus being passed on. Any comments or statements made in this are not necessarily those of FBS India or any other Fidelity entity. All e-mails sent from or to FBS India may be subject to our monitoring and recording procedures. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Include dependency jars in the resources
> I am new to Maven so, please help me out with the solution. > I have set up a Java project and the pom creates a jar out of it. It has > 5 dependency jars which are in my repository and the project refers to > it fine (M2_REPO) > This worries me. What do you mean by "M2_REPO"? You shouldn't have any references to the (local) repository in your project. > These external jars are being placed under src directory but are not > packaged with jar. > How are these jars being placed in the src folder? Anything being produced/copied/unpacked/etc during the build process should be put in the target folder. > I want to include these external jars in my jar. (Do not want to place > each jar in resource manually) > > How do you tell pom.xml to include dependency jars in resources of the > jar? > Did you try googling? http://www.mail-archive.com/users@maven.apache.org/msg72607.html /Anders
Re: Include dependency jars in the resources
If I got what you meant, you could put the jars in the directory src/main/resources (which is Maven's standard directory for resources) and then Maven would include it in the root of the final generated jar. Regards, Rafael. On Thu, Apr 7, 2011 at 9:14 AM, Sathyanarayana, Divya < divya.sathyanaray...@fmr.com> wrote: > Hi, > I am new to Maven so, please help me out with the solution. > I have set up a Java project and the pom creates a jar out of it. It has > 5 dependency jars which are in my repository and the project refers to > it fine (M2_REPO) > These external jars are being placed under src directory but are not > packaged with jar. > I want to include these external jars in my jar. (Do not want to place > each jar in resource manually) > > How do you tell pom.xml to include dependency jars in resources of the > jar? > > > Regards, > Divya Arun > Fidelity India > > This e-mail, including any attachment(s) hereto, is intended only for > the individual or entity to whom it is addressed. It may contain > proprietary, confidential or privileged information or attorney work > product belonging to Fidelity Business Services India Pvt. Ltd. (FBS > India) or its affiliates. If you are not the intended recipient of this > e-mail, or if you have otherwise received this e-mail in error, please > immediately notify the sender via return e-mail and permanently delete > the original mail, any print outs and any copies, including any > attachments. Any dissemination, distribution, alteration or copying of > this e-mail is strictly prohibited. The originator of this e-mail does > not guarantee the security of this message and will not be responsible > for any damages arising from any dissemination, distribution, alteration > or copying of this message and/or any attachments to this message by a > third party or as a result of any virus being passed on. Any comments or > statements made in this are not necessarily those of FBS India or any > other Fidelity entity. All e-mails sent from or to FBS India may be > subject to our monitoring and recording procedures. > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: Include dependency jars in the resources
Oh, no! He should not! This is what Maven's dependency management should be used for. /Anders On Thu, Apr 7, 2011 at 14:54, Rafael Vanderlei wrote: > If I got what you meant, you could put the jars in the directory > src/main/resources (which is Maven's standard directory for resources) and > then Maven would include it in the root of the final generated jar. > > Regards, > Rafael. > > On Thu, Apr 7, 2011 at 9:14 AM, Sathyanarayana, Divya < > divya.sathyanaray...@fmr.com> wrote: > > > Hi, > > I am new to Maven so, please help me out with the solution. > > I have set up a Java project and the pom creates a jar out of it. It has > > 5 dependency jars which are in my repository and the project refers to > > it fine (M2_REPO) > > These external jars are being placed under src directory but are not > > packaged with jar. > > I want to include these external jars in my jar. (Do not want to place > > each jar in resource manually) > > > > How do you tell pom.xml to include dependency jars in resources of the > > jar? > > > > > > Regards, > > Divya Arun > > Fidelity India > > > > This e-mail, including any attachment(s) hereto, is intended only for > > the individual or entity to whom it is addressed. It may contain > > proprietary, confidential or privileged information or attorney work > > product belonging to Fidelity Business Services India Pvt. Ltd. (FBS > > India) or its affiliates. If you are not the intended recipient of this > > e-mail, or if you have otherwise received this e-mail in error, please > > immediately notify the sender via return e-mail and permanently delete > > the original mail, any print outs and any copies, including any > > attachments. Any dissemination, distribution, alteration or copying of > > this e-mail is strictly prohibited. The originator of this e-mail does > > not guarantee the security of this message and will not be responsible > > for any damages arising from any dissemination, distribution, alteration > > or copying of this message and/or any attachments to this message by a > > third party or as a result of any virus being passed on. Any comments or > > statements made in this are not necessarily those of FBS India or any > > other Fidelity entity. All e-mails sent from or to FBS India may be > > subject to our monitoring and recording procedures. > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > > > >
Re: Include dependency jars in the resources
'Course he must use Maven´s dependency management to include dependency jars in classpath, but if for some reason of his he wants to include some jars inside the one jar he is actually building, I think the best option would be to make Maven think it´s a resource. I cant see how maven would include 5 jars inside another just by using it´s default dependency management. On Thu, Apr 7, 2011 at 9:56 AM, Anders Hammar wrote: > Oh, no! He should not! > This is what Maven's dependency management should be used for. > > /Anders > > On Thu, Apr 7, 2011 at 14:54, Rafael Vanderlei >wrote: > > > If I got what you meant, you could put the jars in the directory > > src/main/resources (which is Maven's standard directory for resources) > and > > then Maven would include it in the root of the final generated jar. > > > > Regards, > > Rafael. > > > > On Thu, Apr 7, 2011 at 9:14 AM, Sathyanarayana, Divya < > > divya.sathyanaray...@fmr.com> wrote: > > > > > Hi, > > > I am new to Maven so, please help me out with the solution. > > > I have set up a Java project and the pom creates a jar out of it. It > has > > > 5 dependency jars which are in my repository and the project refers to > > > it fine (M2_REPO) > > > These external jars are being placed under src directory but are not > > > packaged with jar. > > > I want to include these external jars in my jar. (Do not want to place > > > each jar in resource manually) > > > > > > How do you tell pom.xml to include dependency jars in resources of the > > > jar? > > > > > > > > > Regards, > > > Divya Arun > > > Fidelity India > > > > > > This e-mail, including any attachment(s) hereto, is intended only for > > > the individual or entity to whom it is addressed. It may contain > > > proprietary, confidential or privileged information or attorney work > > > product belonging to Fidelity Business Services India Pvt. Ltd. (FBS > > > India) or its affiliates. If you are not the intended recipient of this > > > e-mail, or if you have otherwise received this e-mail in error, please > > > immediately notify the sender via return e-mail and permanently delete > > > the original mail, any print outs and any copies, including any > > > attachments. Any dissemination, distribution, alteration or copying of > > > this e-mail is strictly prohibited. The originator of this e-mail does > > > not guarantee the security of this message and will not be responsible > > > for any damages arising from any dissemination, distribution, > alteration > > > or copying of this message and/or any attachments to this message by a > > > third party or as a result of any virus being passed on. Any comments > or > > > statements made in this are not necessarily those of FBS India or any > > > other Fidelity entity. All e-mails sent from or to FBS India may be > > > subject to our monitoring and recording procedures. > > > > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > > For additional commands, e-mail: users-h...@maven.apache.org > > > > > > > > >
Re: Include dependency jars in the resources
You can (and i think you should) use the assembly-plugin, if you want to do that. Manuel On Thu, Apr 7, 2011 at 15:08, Rafael Vanderlei wrote: > 'Course he must use Maven´s dependency management to include dependency jars > in classpath, but if for some reason of his he wants to include some jars > inside the one jar he is actually building, I think the best option would be > to make Maven think it´s a resource. I cant see how maven would include 5 > jars inside another just by using it´s default dependency management. > > On Thu, Apr 7, 2011 at 9:56 AM, Anders Hammar wrote: > >> Oh, no! He should not! >> This is what Maven's dependency management should be used for. >> >> /Anders >> >> On Thu, Apr 7, 2011 at 14:54, Rafael Vanderlei > >wrote: >> >> > If I got what you meant, you could put the jars in the directory >> > src/main/resources (which is Maven's standard directory for resources) >> and >> > then Maven would include it in the root of the final generated jar. >> > >> > Regards, >> > Rafael. >> > >> > On Thu, Apr 7, 2011 at 9:14 AM, Sathyanarayana, Divya < >> > divya.sathyanaray...@fmr.com> wrote: >> > >> > > Hi, >> > > I am new to Maven so, please help me out with the solution. >> > > I have set up a Java project and the pom creates a jar out of it. It >> has >> > > 5 dependency jars which are in my repository and the project refers to >> > > it fine (M2_REPO) >> > > These external jars are being placed under src directory but are not >> > > packaged with jar. >> > > I want to include these external jars in my jar. (Do not want to place >> > > each jar in resource manually) >> > > >> > > How do you tell pom.xml to include dependency jars in resources of the >> > > jar? >> > > >> > > >> > > Regards, >> > > Divya Arun >> > > Fidelity India >> > > >> > > This e-mail, including any attachment(s) hereto, is intended only for >> > > the individual or entity to whom it is addressed. It may contain >> > > proprietary, confidential or privileged information or attorney work >> > > product belonging to Fidelity Business Services India Pvt. Ltd. (FBS >> > > India) or its affiliates. If you are not the intended recipient of this >> > > e-mail, or if you have otherwise received this e-mail in error, please >> > > immediately notify the sender via return e-mail and permanently delete >> > > the original mail, any print outs and any copies, including any >> > > attachments. Any dissemination, distribution, alteration or copying of >> > > this e-mail is strictly prohibited. The originator of this e-mail does >> > > not guarantee the security of this message and will not be responsible >> > > for any damages arising from any dissemination, distribution, >> alteration >> > > or copying of this message and/or any attachments to this message by a >> > > third party or as a result of any virus being passed on. Any comments >> or >> > > statements made in this are not necessarily those of FBS India or any >> > > other Fidelity entity. All e-mails sent from or to FBS India may be >> > > subject to our monitoring and recording procedures. >> > > >> > > >> > > - >> > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> > > For additional commands, e-mail: users-h...@maven.apache.org >> > > >> > > >> > >> > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Include dependency jars in the resources
Yes but I do not want to do that manually. Is there a way to tell pom to include it in src/main/resources? Regards, Divya Arun This e-mail, including any attachment(s) hereto, is intended only for the individual or entity to whom it is addressed. It may contain proprietary, confidential or privileged information or attorney work product belonging to Fidelity Business Services India Pvt. Ltd. (FBS India) or its affiliates. If you are not the intended recipient of this e-mail, or if you have otherwise received this e-mail in error, please immediately notify the sender via return e-mail and permanently delete the original mail, any print outs and any copies, including any attachments. Any dissemination, distribution, alteration or copying of this e-mail is strictly prohibited. The originator of this e-mail does not guarantee the security of this message and will not be responsible for any damages arising from any dissemination, distribution, alteration or copying of this message and/or any attachments to this message by a third party or as a result of any virus being passed on. Any comments or statements made in this are not necessarily those of FBS India or any other Fidelity entity. All e-mails sent from or to FBS India may be subject to our monitoring and recording procedures. _ From: Rafael Vanderlei [mailto:rafaelvander...@gmail.com] Sent: Thursday, April 07, 2011 6:25 PM To: Maven Users List Cc: Sathyanarayana, Divya Subject: Re: Include dependency jars in the resources If I got what you meant, you could put the jars in the directory src/main/resources (which is Maven's standard directory for resources) and then Maven would include it in the root of the final generated jar. Regards, Rafael. On Thu, Apr 7, 2011 at 9:14 AM, Sathyanarayana, Divya wrote: Hi, I am new to Maven so, please help me out with the solution. I have set up a Java project and the pom creates a jar out of it. It has 5 dependency jars which are in my repository and the project refers to it fine (M2_REPO) These external jars are being placed under src directory but are not packaged with jar. I want to include these external jars in my jar. (Do not want to place each jar in resource manually) How do you tell pom.xml to include dependency jars in resources of the jar? Regards, Divya Arun Fidelity India This e-mail, including any attachment(s) hereto, is intended only for the individual or entity to whom it is addressed. It may contain proprietary, confidential or privileged information or attorney work product belonging to Fidelity Business Services India Pvt. Ltd. (FBS India) or its affiliates. If you are not the intended recipient of this e-mail, or if you have otherwise received this e-mail in error, please immediately notify the sender via return e-mail and permanently delete the original mail, any print outs and any copies, including any attachments. Any dissemination, distribution, alteration or copying of this e-mail is strictly prohibited. The originator of this e-mail does not guarantee the security of this message and will not be responsible for any damages arising from any dissemination, distribution, alteration or copying of this message and/or any attachments to this message by a third party or as a result of any virus being passed on. Any comments or statements made in this are not necessarily those of FBS India or any other Fidelity entity. All e-mails sent from or to FBS India may be subject to our monitoring and recording procedures. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Include dependency jars in the resources
what I think you are asking to do is: 1. add the jars you want to embed (you do know that the jar spec does not support opening jars within jars as if they are jars... you can process them youself, but they cannot be added to the classpath) as dependencies to the pom with some scope that is not transitive (provided is probably best) 2. use the maven dependency plugin's copy-dependencies goal to copy the artifacts (you will need to use the includeScope/includeArtifactIds/includeGroupIds to carefully pull out just the ones you want) and have it output them in ${project.build.directory}/generated-resources/dependency 3. use the buildhelper-maven-plugin @mojo's add-resource goal to add ${project.build.directory}/generated-resources/dependency as a resource directory and presto-chango you will have the jars you selected embedded within your jar. -Stephen P.S. I suspect you will find that you have hit the perils of getting what you asked is not always what you want On 7 April 2011 14:17, Sathyanarayana, Divya wrote: > Yes but I do not want to do that manually. Is there a way to tell pom to > include it in src/main/resources? > > Regards, > Divya Arun > > This e-mail, including any attachment(s) hereto, is intended only for > the individual or entity to whom it is addressed. It may contain > proprietary, confidential or privileged information or attorney work > product belonging to Fidelity Business Services India Pvt. Ltd. (FBS > India) or its affiliates. If you are not the intended recipient of this > e-mail, or if you have otherwise received this e-mail in error, please > immediately notify the sender via return e-mail and permanently delete > the original mail, any print outs and any copies, including any > attachments. Any dissemination, distribution, alteration or copying of > this e-mail is strictly prohibited. The originator of this e-mail does > not guarantee the security of this message and will not be responsible > for any damages arising from any dissemination, distribution, alteration > or copying of this message and/or any attachments to this message by a > third party or as a result of any virus being passed on. Any comments or > statements made in this are not necessarily those of FBS India or any > other Fidelity entity. All e-mails sent from or to FBS India may be > subject to our monitoring and recording procedures. > > > > > _ > > From: Rafael Vanderlei [mailto:rafaelvander...@gmail.com] > Sent: Thursday, April 07, 2011 6:25 PM > To: Maven Users List > Cc: Sathyanarayana, Divya > Subject: Re: Include dependency jars in the resources > > > If I got what you meant, you could put the jars in the directory > src/main/resources (which is Maven's standard directory for resources) > and then Maven would include it in the root of the final generated jar. > > Regards, > Rafael. > > > On Thu, Apr 7, 2011 at 9:14 AM, Sathyanarayana, Divya > wrote: > > > Hi, > I am new to Maven so, please help me out with the > solution. > I have set up a Java project and the pom creates a jar > out of it. It has > 5 dependency jars which are in my repository and the > project refers to > it fine (M2_REPO) > These external jars are being placed under src directory > but are not > packaged with jar. > I want to include these external jars in my jar. (Do not > want to place > each jar in resource manually) > > How do you tell pom.xml to include dependency jars in > resources of the > jar? > > > Regards, > Divya Arun > Fidelity India > > This e-mail, including any attachment(s) hereto, is > intended only for > the individual or entity to whom it is addressed. It may > contain > proprietary, confidential or privileged information or > attorney work > product belonging to Fidelity Business Services India > Pvt. Ltd. (FBS > India) or its affiliates. If you are not the intended > recipient of this > e-mail, or if you have otherwise received this e-mail in > error, please > immediately notify the sender via return e-mail and > permanently delete > the original mail, any print outs and any copies, > including any > attachments. Any dissemination, distribution, alteration > or copying of > this e-mail is strictly prohibited. The originator of > this e-mail does > not guarantee the security of thi