Re: Modify Classpath
This is exactly what I am doing - an integration test. I decided to create a separate "test" subproject that is a peer to the "tested" subprojects. I hoped that by declaring the same parent in my test subproject and inheriting all the project's dependencies I will be able to avoid version confusions and test the artifacts whose versions are perfectly aligned. I did not want to employ any hecks to solve my artifact availability problem, but to do it entirely with dependency mechanism available in maven. Michael McCallum-3 wrote: > > in my particular case i needed the code for integration tests so was > borderline as to whether the artifact was actually separate or not... > > but in general i would agree > On Wed, 14 May 2008 12:02:13 Brian E. Fox wrote: >> If you have classes that you need outside a war, the correct way is to >> make this into a jar that is used externally and also packaged inside >> your war. >> > > -- > Michael McCallum > Enterprise Engineer > mailto:[EMAIL PROTECTED] > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Modify-Classpath-tp17215208p17236473.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modify Classpath
in my particular case i needed the code for integration tests so was borderline as to whether the artifact was actually separate or not... but in general i would agree On Wed, 14 May 2008 12:02:13 Brian E. Fox wrote: > If you have classes that you need outside a war, the correct way is to > make this into a jar that is used externally and also packaged inside > your war. > -- Michael McCallum Enterprise Engineer mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modify Classpath
If you have classes that you need outside a war, the correct way is to make this into a jar that is used externally and also packaged inside your war. -Original Message- From: vicki [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 13, 2008 6:49 PM To: users@maven.apache.org Subject: Re: Modify Classpath Olivier, thank you very much for the advice. Unfortunately, my quick test of build-classpath did did not solve my runtime classpath problem. First of all, the examples of the build-classpath goal that I saw, show how to output the project's classpath to a file. What I need is to add project dependencies to a runtime of a maven's "exec" plugin. I did use an tag that I set to true, hoping that this will take care of putting all the dependencies into the runtime, but it didn't. Second, the output file with a classpath that build-classpath goal produced, did not resolved the artifacts that are packaged as wars. It does put wars in the classpath, but this, naturally, does not make classes inside these wars available in the runtime. Olivier Dehon-2 wrote: > > Have a look at the build-classpath goal of the dependency plugin: > http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath- mojo.html > > -Olivier > > On Tue, 2008-05-13 at 11:23 -0700, vicki wrote: >> Hello, >> I have a maven's subproject that runs tests against the artifacts of its >> piers subprojects. Obviously, In other words, to run my tests I need to >> create dependencies on the artifacts produced by the other subprojects. I >> run my tests with maven's "exec" plugin. All the artifacts packaged as >> jars >> are indeed on my classpath when I run maven exec. But dependencies on the >> artifacts packaged as wars are not resolved in such a way that classes >> directory inside these wars are put on the classpath. I do not want to >> explicitly specify a classpath in the configuration of maven exec plugin. >> Instead I'd like to have a classpath that is build with project's >> dependencies. Can anyone advise a good way of doing this? >> Thanks a lot. >> Vicki >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Modify-Classpath-tp17215208p17220036.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modify Classpath
On Wed, 14 May 2008 11:18:54 Wendy Smoak wrote: > On Tue, May 13, 2008 at 11:23 AM, vicki <[EMAIL PROTECTED]> wrote: > > I have a maven's subproject that runs tests against the artifacts of its > > piers subprojects. Obviously, In other words, to run my tests I need to > > create dependencies on the artifacts produced by the other subprojects. > > I run my tests with maven's "exec" plugin. All the artifacts packaged as > > jars are indeed on my classpath when I run maven exec. But dependencies > > on the artifacts packaged as wars are not resolved in such a way that > > classes directory inside these wars are put on the classpath. > > Java simply has no concept of putting a war file on the classpath. If > you have code in a war module that you need to use elsewhere, the best > idea is to move the code to a separate module that builds a jar. That > jar then becomes a dependency of your war module plus any other module > that needs it. > > If you absolutely can't move the code, the next version of the war > plugin will have the ability to deploy a classified/attached artifact > containing the code from a war module. 1) you can make the packaging type of the project jar 2) add a config for the war plugin to execute war... maven-war-plugin 2.1-alpha-1 war true application 3) this gives you a jar and a war 4) you can then depend upon the jar (default) artifact to get the deps of this project and if you need to a.b a.b.c [1,2-!) 5) to use this war as an underlay you can depend on the project with classifier 'application' a.b a.b.c [1,2-!) war -- Michael McCallum Enterprise Engineer mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modify Classpath
On Tue, May 13, 2008 at 11:23 AM, vicki <[EMAIL PROTECTED]> wrote: > I have a maven's subproject that runs tests against the artifacts of its > piers subprojects. Obviously, In other words, to run my tests I need to > create dependencies on the artifacts produced by the other subprojects. I > run my tests with maven's "exec" plugin. All the artifacts packaged as jars > are indeed on my classpath when I run maven exec. But dependencies on the > artifacts packaged as wars are not resolved in such a way that classes > directory inside these wars are put on the classpath. Java simply has no concept of putting a war file on the classpath. If you have code in a war module that you need to use elsewhere, the best idea is to move the code to a separate module that builds a jar. That jar then becomes a dependency of your war module plus any other module that needs it. If you absolutely can't move the code, the next version of the war plugin will have the ability to deploy a classified/attached artifact containing the code from a war module. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modify Classpath
Olivier, thank you very much for the advice. Unfortunately, my quick test of build-classpath did did not solve my runtime classpath problem. First of all, the examples of the build-classpath goal that I saw, show how to output the project's classpath to a file. What I need is to add project dependencies to a runtime of a maven's "exec" plugin. I did use an tag that I set to true, hoping that this will take care of putting all the dependencies into the runtime, but it didn't. Second, the output file with a classpath that build-classpath goal produced, did not resolved the artifacts that are packaged as wars. It does put wars in the classpath, but this, naturally, does not make classes inside these wars available in the runtime. Olivier Dehon-2 wrote: > > Have a look at the build-classpath goal of the dependency plugin: > http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html > > -Olivier > > On Tue, 2008-05-13 at 11:23 -0700, vicki wrote: >> Hello, >> I have a maven's subproject that runs tests against the artifacts of its >> piers subprojects. Obviously, In other words, to run my tests I need to >> create dependencies on the artifacts produced by the other subprojects. I >> run my tests with maven's "exec" plugin. All the artifacts packaged as >> jars >> are indeed on my classpath when I run maven exec. But dependencies on the >> artifacts packaged as wars are not resolved in such a way that classes >> directory inside these wars are put on the classpath. I do not want to >> explicitly specify a classpath in the configuration of maven exec plugin. >> Instead I'd like to have a classpath that is build with project's >> dependencies. Can anyone advise a good way of doing this? >> Thanks a lot. >> Vicki >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Modify-Classpath-tp17215208p17220036.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modify Classpath
Have a look at the build-classpath goal of the dependency plugin: http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html -Olivier On Tue, 2008-05-13 at 11:23 -0700, vicki wrote: > Hello, > I have a maven's subproject that runs tests against the artifacts of its > piers subprojects. Obviously, In other words, to run my tests I need to > create dependencies on the artifacts produced by the other subprojects. I > run my tests with maven's "exec" plugin. All the artifacts packaged as jars > are indeed on my classpath when I run maven exec. But dependencies on the > artifacts packaged as wars are not resolved in such a way that classes > directory inside these wars are put on the classpath. I do not want to > explicitly specify a classpath in the configuration of maven exec plugin. > Instead I'd like to have a classpath that is build with project's > dependencies. Can anyone advise a good way of doing this? > Thanks a lot. > Vicki > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]