Re: Conditional dependencies
Hi Michael, thanks a lot for your answer. This is how we are currently doing it. In reality our scenario is a bit more complicated than the given database example. We have many artifacts (like A and B), and a whole lot of "connection" parts (like A2B), that would be better placed in their own artifacts, provided that they are used when both artifacts are in the classpath, and we don't want to have the user bother with these connection artifacts. Also because A and B could arrive in the classpath via transiitive dependencies, so the user have no idea (if not doing a dependency:tree) that they are there and the connection part A2B is missing. As a last resort, do you think a plugin can handle these "dynamic" dependencies? Can a plugin add dependencies to the project, and then have them resolved and used in the rest of the build lifecycle? Maybe binding to one of the early phases? Simone Michael McCallum wrote: > wrap the dependency for the db driver in a pom project that also depends upon > the dialect > > e.g. > > example.company.db.posgresql > -> postgresql jdc driver > -> postgresql database dialect > > then > > example.company.applicationwithdb > -> example.company.db.postgresql > > profiles should not be used to munge up dependencies, it just makes it > confusing for people to have side effects. > > On Mon, 06 Oct 2008 05:47:16 Simone Gianni wrote: > >> Has anybody ever done something >> like this? Has anybody had the same need and investigated a way to solve >> it? >> > > > > -- Simone GianniCEO Semeru s.r.l. Apache Committer MALE human being programming a computer http://www.simonegianni.it/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conditional dependencies
wrap the dependency for the db driver in a pom project that also depends upon the dialect e.g. example.company.db.posgresql -> postgresql jdc driver -> postgresql database dialect then example.company.applicationwithdb -> example.company.db.postgresql profiles should not be used to munge up dependencies, it just makes it confusing for people to have side effects. On Mon, 06 Oct 2008 05:47:16 Simone Gianni wrote: > Has anybody ever done something > like this? Has anybody had the same need and investigated a way to solve > it? -- Michael McCallum Enterprise Engineer mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Conditional dependencies
Hi all, I would like to include or exclude a dependency based on the presence of an artifact on the global class path. For example, I have a database project. The user will include a dependency on it in his own pom. The user will also add a JDBC driver artifact. My database project should be able to declare additional dependencies depending on the presence of specific JDBC drivers artifacts, for example a database-mysql-dialect if the mysql-connector is used, or the database-postgres-dialect if the postgres driver is used. Whle it is possible to check at runtime, using reflection and the like, the presence of a given class, it lacks versioning, it is not a clean way, it clutters the main package code with stuff that could (and should) be placed in different artifacts. I don't know any way to do this in Maven right now. Theoretically, it could be achieved with profile activation, if there was a profile activation based on the presence of an artifact or at least on the presence of classpath resources instead of plain files. Is it possible to implement such a profile activator? Has anybody ever done something like this? Has anybody had the same need and investigated a way to solve it? Thanks in advance, Simone -- Simone GianniCEO Semeru s.r.l. Apache Committer MALE human being programming a computer http://www.simonegianni.it/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: conditional dependencies
The problem I see with conditional dependencies is that they define the dependencies that Maven needs in order to build/test the artifact. So if I do a build on java6, my conditional dependencies will exclude javax.activation... I assume the Release/deploy plugins will upload the effective pom for my build environment, which does not include javax.activation... Now you come along and depend on my artifact, but are building with java5... so you do not receive the conditional dependency. On the other hand if the release/deploy plugins upload the pom and it's profile definitions, Maven is going to have to re-detect the profile activation to determine the transitive dependencies (Which I don't thinkk it does) -Stephen On Feb 5, 2008 8:20 AM, SlinnHawkins, Jon (ELS-CAM) < [EMAIL PROTECTED]> wrote: > Hi Jorg > > Yeah just set up profiles for Java5 and java6 each specifying the unique > dependencies for the jdk. > > Jon > > -Original Message- > From: Joerg Hohwiller [mailto:[EMAIL PROTECTED] > Sent: 04 February 2008 21:13 > To: Maven Users List > Subject: conditional dependencies > > Hi there, > > I am using conditional dependencies in the form that I use variables in > the dependencies and profiles to set these variables. > > Now I currently wonder what to do if a dependency is only required under > specific situations. E.g. stax or jsr250 is included in java6 while you > need dependencies on external artifacts for java5. > Has someone experience with that? > Is it best to use a variable for the scope and set it to "provided" for > java6? > Or is it possible to add a dependency into the profile section? > > Thanks > Jörg > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > This email is from Elsevier Limited, a company registered in England and > Wales with company number 1982084, > whose registered office is The Boulevard, Langford Lane, Kidlington, > Oxford, OX5 1GB, United Kingdom. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: conditional dependencies
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Hi Jorg Hi Jon, > > Yeah just set up profiles for Java5 and java6 each specifying the unique > dependencies for the jdk. So what you are saying is that it really works to declare a dependency within a profile section? I have NOT tried this again since maven 2.0.4. but it did not work properly then. And shouldn't there be POMs with packaging "pom" in central repo to do this for stax, jsr250, etc., so it is a centralized feature? Then everybody could just add a dependency on "stax-profile" (or however one would call it) with type "pom" and that is all. > > Jon Thanks so far... Jörg > > -Original Message- > From: Joerg Hohwiller [mailto:[EMAIL PROTECTED] > Sent: 04 February 2008 21:13 > To: Maven Users List > Subject: conditional dependencies > > Hi there, > > I am using conditional dependencies in the form that I use variables in the > dependencies and profiles to set these variables. > > Now I currently wonder what to do if a dependency is only required under > specific situations. E.g. stax or jsr250 is included in java6 while you need > dependencies on external artifacts for java5. > Has someone experience with that? > Is it best to use a variable for the scope and set it to "provided" for java6? > Or is it possible to add a dependency into the profile section? > > Thanks >Jörg > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > This email is from Elsevier Limited, a company registered in England and > Wales with company number 1982084, > whose registered office is The Boulevard, Langford Lane, Kidlington, Oxford, > OX5 1GB, United Kingdom. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHqi63mPuec2Dcv/8RAqbhAJ0XS6VBZWDHiW7YcRwhF3jZ8c+uygCfcuj+ KyKGgIxxrLJR2zeEVOdRFTw= =Glsg -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: conditional dependencies
Hi Jorg Yeah just set up profiles for Java5 and java6 each specifying the unique dependencies for the jdk. Jon -Original Message- From: Joerg Hohwiller [mailto:[EMAIL PROTECTED] Sent: 04 February 2008 21:13 To: Maven Users List Subject: conditional dependencies Hi there, I am using conditional dependencies in the form that I use variables in the dependencies and profiles to set these variables. Now I currently wonder what to do if a dependency is only required under specific situations. E.g. stax or jsr250 is included in java6 while you need dependencies on external artifacts for java5. Has someone experience with that? Is it best to use a variable for the scope and set it to "provided" for java6? Or is it possible to add a dependency into the profile section? Thanks Jörg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email is from Elsevier Limited, a company registered in England and Wales with company number 1982084, whose registered office is The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, United Kingdom. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
conditional dependencies
Hi there, I am using conditional dependencies in the form that I use variables in the dependencies and profiles to set these variables. Now I currently wonder what to do if a dependency is only required under specific situations. E.g. stax or jsr250 is included in java6 while you need dependencies on external artifacts for java5. Has someone experience with that? Is it best to use a variable for the scope and set it to "provided" for java6? Or is it possible to add a dependency into the profile section? Thanks Jörg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conditional Dependencies?
If you can't/won't create the various profiles to support this functionality, I think you're going to need to write a plugin (or two) to do all this. Its just not supported in the core, and I don't see it being added any time soon, so a plugin seems the only way forward. Wayne On 5/4/07, Manos Batsis <[EMAIL PROTECTED]> wrote: Wayne Fay wrote: > The only way I've seen of making dependencies "conditional" is via > profiles. That would create too many profiles for me. Suppose an EAR parent's POM, where the EAR can have multiple modules one can choose from and configure. For example struts 1.x or 2.x based web module, ejb 2.1 or 3.0 module, use of HDIV [1] in the web module and so on and so forth. I'm trying to figure the best way to go about this for my md4j [2] quickstarter project. [1] http://www.hdiv.org/ [2] http://dev.abiss.gr/md4j/ Cheers, Manos - 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: Conditional Dependencies?
Wayne Fay wrote: The only way I've seen of making dependencies "conditional" is via profiles. That would create too many profiles for me. Suppose an EAR parent's POM, where the EAR can have multiple modules one can choose from and configure. For example struts 1.x or 2.x based web module, ejb 2.1 or 3.0 module, use of HDIV [1] in the web module and so on and so forth. I'm trying to figure the best way to go about this for my md4j [2] quickstarter project. [1] http://www.hdiv.org/ [2] http://dev.abiss.gr/md4j/ Cheers, Manos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conditional Dependencies?
The only way I've seen of making dependencies "conditional" is via profiles. What exactly are you trying to do? Wayne On 5/4/07, Manos Batsis <[EMAIL PROTECTED]> wrote: Hello, Is there a way to have conditional dependencies based on custom properties, including artifacts and/or their versions? Many thanks, Manos - 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]
Conditional Dependencies?
Hello, Is there a way to have conditional dependencies based on custom properties, including artifacts and/or their versions? Many thanks, Manos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conditional dependencies in M2
optional dependencies are set with They are not transitive, so if you decide to use that from other project you need to explicitly add jdom, and that will bring all jdom transitive dependencies On 4/25/06, Clifton Craig <[EMAIL PROTECTED]> wrote: > On Monday 24 April 2006 3:51 pm, Mike Perham wrote: > > test is the closest thing I can think of. Test dependencies > > are not transitive so you need to declare them in each module. > > Right, I saw that but didn't know if the scoped would allow transitive > behaviour. I also don't know much of other available scopes. So let's say I > have a project, MyUtils, with a dependency on XMLUnit scoped to test and > another optional dependency on JDOM. JDOM is only necessary if you want to > use XPath features wrapped by MyUtils and provided by JDOM. Now I want to > include Myutils in another project but I only want to use some collections > classes also found in MyUtils and have no need for the wrapping of JDOM. How > do I set the POM for MyUtils such that JDOM is not transitively included? > More importantly how do I set it such that JDOM is automatically included > with another project that does want to use the wrapped JDOM functionality > from MyUtils without changing the POM for either project? Is profiles the > answer? > > --- > Clifton C. Craig, Software Engineer > Intelligent Computer Systems - A Division of GBG > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- I could give you my word as a Spaniard. No good. I've known too many Spaniards. -- The Princess Bride - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conditional dependencies in M2
I think you should specify some of the MyUtils dependencies as being optionnal. I don't really know how it works but I know this is what you are looking for. Maybe others can help you here. On 4/25/06, Clifton Craig <[EMAIL PROTECTED]> wrote: > On Monday 24 April 2006 3:51 pm, Mike Perham wrote: > > test is the closest thing I can think of. Test dependencies > > are not transitive so you need to declare them in each module. > > Right, I saw that but didn't know if the scoped would allow transitive > behaviour. I also don't know much of other available scopes. So let's say I > have a project, MyUtils, with a dependency on XMLUnit scoped to test and > another optional dependency on JDOM. JDOM is only necessary if you want to > use XPath features wrapped by MyUtils and provided by JDOM. Now I want to > include Myutils in another project but I only want to use some collections > classes also found in MyUtils and have no need for the wrapping of JDOM. How > do I set the POM for MyUtils such that JDOM is not transitively included? > More importantly how do I set it such that JDOM is automatically included > with another project that does want to use the wrapped JDOM functionality > from MyUtils without changing the POM for either project? Is profiles the > answer? > > --- > Clifton C. Craig, Software Engineer > Intelligent Computer Systems - A Division of GBG > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > - > 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: Conditional dependencies in M2
On Monday 24 April 2006 3:51 pm, Mike Perham wrote: > test is the closest thing I can think of. Test dependencies > are not transitive so you need to declare them in each module. Right, I saw that but didn't know if the scoped would allow transitive behaviour. I also don't know much of other available scopes. So let's say I have a project, MyUtils, with a dependency on XMLUnit scoped to test and another optional dependency on JDOM. JDOM is only necessary if you want to use XPath features wrapped by MyUtils and provided by JDOM. Now I want to include Myutils in another project but I only want to use some collections classes also found in MyUtils and have no need for the wrapping of JDOM. How do I set the POM for MyUtils such that JDOM is not transitively included? More importantly how do I set it such that JDOM is automatically included with another project that does want to use the wrapped JDOM functionality from MyUtils without changing the POM for either project? Is profiles the answer? --- Clifton C. Craig, Software Engineer Intelligent Computer Systems - A Division of GBG [EMAIL PROTECTED] [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Conditional dependencies in M2
test is the closest thing I can think of. Test dependencies are not transitive so you need to declare them in each module. -Original Message- From: Clifton Craig [mailto:[EMAIL PROTECTED] Sent: Monday, April 24, 2006 2:15 PM To: users@maven.apache.org Subject: Conditional dependencies in M2 Hello all, I am converting from Ant/Ivy to Maven2 and I have a question regarding dependencies in Maven2. In Ivy I could define dependencies which would be conditionally considered based on my build configuration. for example, I could define in a project Foo, a dependency on Bar for all configurations and a dependecy on Box for the test configuration of project Foo. Then, another project, say Fuzz, could depend on Foo and use either its default configuration (which would transitivly bring in Bar but not Box) or use its test configuration (which would transitivly bring in Bar AND Box). How is this done in Maven? I read up on profiles and I'm wondering if that's the answer, or if there's a more straight foward way of doing the same. Could somebody provide an example of a Maven equivalent? Thanx in advance. --- Clifton C. Craig, Software Engineer Intelligent Computer Systems - A Division of GBG [EMAIL PROTECTED] [EMAIL PROTECTED] - 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: Conditional dependencies in M2
This is what you are looking for : http://maven.apache.org/guides/introduction/introduction-to-profiles.html On 4/24/06, Clifton Craig <[EMAIL PROTECTED]> wrote: > Hello all, > > I am converting from Ant/Ivy to Maven2 and I have a question regarding > dependencies in Maven2. In Ivy I could define dependencies which would be > conditionally considered based on my build configuration. for example, I > could define in a project Foo, a dependency on Bar for all configurations and > a dependecy on Box for the test configuration of project Foo. Then, another > project, say Fuzz, could depend on Foo and use either its default > configuration (which would transitivly bring in Bar but not Box) or use its > test configuration (which would transitivly bring in Bar AND Box). How is > this done in Maven? I read up on profiles and I'm wondering if that's the > answer, or if there's a more straight foward way of doing the same. Could > somebody provide an example of a Maven equivalent? Thanx in advance. > > --- > Clifton C. Craig, Software Engineer > Intelligent Computer Systems - A Division of GBG > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > - > 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]
Conditional dependencies in M2
Hello all, I am converting from Ant/Ivy to Maven2 and I have a question regarding dependencies in Maven2. In Ivy I could define dependencies which would be conditionally considered based on my build configuration. for example, I could define in a project Foo, a dependency on Bar for all configurations and a dependecy on Box for the test configuration of project Foo. Then, another project, say Fuzz, could depend on Foo and use either its default configuration (which would transitivly bring in Bar but not Box) or use its test configuration (which would transitivly bring in Bar AND Box). How is this done in Maven? I read up on profiles and I'm wondering if that's the answer, or if there's a more straight foward way of doing the same. Could somebody provide an example of a Maven equivalent? Thanx in advance. --- Clifton C. Craig, Software Engineer Intelligent Computer Systems - A Division of GBG [EMAIL PROTECTED] [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m1] Conditional dependencies
From: "Brett Porter" <[EMAIL PROTECTED]> This is a bit "dangerous". Agreed. :) But it works. 1) a project will have a different model depending on that property. It will ripple into needing to change other things like the final name of the built artifact to ensure you don't end up with one thing sometimes being something different Actually... that's the intent. We build a .war file, and it contains whichever JSF implementation you choose-- different .jar files in WEB-INF/lib, web.xml filtered one way or another, but the name of the .war file remains the same. (Remember that this is an existing Ant build...) This is a little bit of an unusual use case. It's understandable that you often depend on a spec dependency (for which we don't yet have great support) and an impl goes into the final bundle and the impl might change. Changing the API too is what is unusual. I agree... but that's the requirement. Anyway, in m1 the general approach to this is to have two projects that do the different bundling and build whichever you want, sharing the common code. I'm not sure if that's easily done when the api is changed though. I've just been introduced to the "leave the project structure alone and put all the build files in a completely separate directory structure" concept. Most of my problems (like building three artifacts out of a single source tree) might just go away. Reorganizing the project itself to suit Maven is definitely not something I want to have to push for. I replied in this fashion in another thread. I should also mention again that environmental changes to project builds are supported in Maven 2. (I missed your earlier responses, thanks for pointing them out.) Okay, okay... I'll look at m2 again. :) Last time it seemed like not enough of the plugins I needed were ready yet. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [m1] Conditional dependencies
Wendy, > Jay, this turned out to work *perfectly*! Glad to hear it, though I agree with Brett that it doesn't necessarily fall in the category of "Best Practice". I'm glad to hear Maven 2 will do a better job of dealing with this kind of issue. One concern was having duplicate artifacts with the same name but different contents. If you haven't already, you might consider using the same property in the artifact ID: myproject-${maven.shale.jsf.impl}. You could also manipulate maven.final.name, I guess, but I think SNAPSHOT builds already do this, so you could end up with conflicts if you did it in the wrong place. Similarly, you could sprinkle that property around in other places to cause, for example, the site to deploy to a different location with a different title and slightly different description. Effectively you end up with two different object models that just happen to share the same codebase. Good luck, Jay -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Thursday, September 01, 2005 10:40 AM To: Maven Users List Subject: Re: [m1] Conditional dependencies From: "Jay H. Hartley" <[EMAIL PROTECTED]> > 2) Create two different "parent" project files, and have the "extends" > parameter depend on a property: > > > ${jsf.project.file} Jay, this turned out to work *perfectly*! project.properties: maven.shale.jsf.impl.default=myfaces -project.xml ${maven.shale.jsf.impl.default}-project.xml project.xml: ${maven.shale.jsf.impl}-project.xml And jsfri-project.xml or myfaces-project.xml declares dependencies on one JSF implementation or the other. So you can either set maven.shale.jsf.impl = [myfaces | jsfri ] or leave it out and let it default. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m1] Conditional dependencies
From: "Jay H. Hartley" <[EMAIL PROTECTED]> 2) Create two different "parent" project files, and have the "extends" parameter depend on a property: ${jsf.project.file} Jay, this turned out to work *perfectly*! project.properties: maven.shale.jsf.impl.default=myfaces -project.xml ${maven.shale.jsf.impl.default}-project.xml project.xml: ${maven.shale.jsf.impl}-project.xml And jsfri-project.xml or myfaces-project.xml declares dependencies on one JSF implementation or the other. So you can either set maven.shale.jsf.impl = [myfaces | jsfri ] or leave it out and let it default. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m1] Conditional dependencies
This is a bit "dangerous". 1) a project will have a different model depending on that property. It will ripple into needing to change other things like the final name of the built artifact to ensure you don't end up with one thing sometimes being something different 2) you can only do this trick once. There is no multiple inheritence. This is a little bit of an unusual use case. It's understandable that you often depend on a spec dependency (for which we don't yet have great support) and an impl goes into the final bundle and the impl might change. Changing the API too is what is unusual. Anyway, in m1 the general approach to this is to have two projects that do the different bundling and build whichever you want, sharing the common code. I'm not sure if that's easily done when the api is changed though. I replied in this fashion in another thread. I should also mention again that environmental changes to project builds are supported in Maven 2. - Brett On 8/31/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: > > From: "Jay H. Hartley" <[EMAIL PROTECTED]> > > > 2) Create two different "parent" project files, and have the "extends" > > parameter depend on a property: > > > > > > ${jsf.project.file} > > That has promise! Thanks, I didn't know you could do that. :) > > If it's not painfully obvious by this point, this is an existing Ant build > that I'm trying to reproduce with Maven. > > After several days of fighting with it, I'm going to retreat to the > position > of making the Maven build do something reasonably useful, and propose a > reorganization to get the project into a format that Maven is happier to > deal with. > > Thanks for putting up with all the questions. :) > > -- > Wendy Smoak > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: [m1] Conditional dependencies
From: "Jay H. Hartley" <[EMAIL PROTECTED]> 2) Create two different "parent" project files, and have the "extends" parameter depend on a property: ${jsf.project.file} That has promise! Thanks, I didn't know you could do that. :) If it's not painfully obvious by this point, this is an existing Ant build that I'm trying to reproduce with Maven. After several days of fighting with it, I'm going to retreat to the position of making the Maven build do something reasonably useful, and propose a reorganization to get the project into a format that Maven is happier to deal with. Thanks for putting up with all the questions. :) -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [m1] Conditional dependencies
Wendy, I can't say I've had this exact problem, but I can think of two approaches I'd consider: 1) Create a separate project, let's call it jsf. Have all the RI/MyFaces jars listed in its dependency list. No code is involved, but the build produces two artifacts, both "uberjars" (not that you'd use the deprecated plug-in) that incorporate all the classes needed for each option. Then your existing approach with single-jar substitution based on a property will continue to work. 2) Create two different "parent" project files, and have the "extends" parameter depend on a property: ${jsf.project.file} ... Those base project files list the dependencies for the appropriate option. You can use the same property to determine how to filter the web.xml file. I did a quick test of this, and both ${pom.extends} and ${pom.dependencies} appear to have gotten modified as I expected. I haven't verified that code compilation, war bundling, etc. work, but since the object model appears correct I would expect everything else to work. I'm sure you could also script up a plug-in, but these two approaches seem relatively simple to me with minimal modifications to your existing scripts. Hope this helps, Jay -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, August 29, 2005 9:15 PM To: Maven Users List Subject: [m1] Conditional dependencies I'm working on a project that needs to compile and build with *either* the JSF Reference Implementation *or* Apache MyFaces. This has to be user-specified, at build time. In addition to compilation and including the correct .jar files in a webapp, there's also a modification that must be done to web.xml, commenting out a section if we're using the RI, leaving it in place for MyFaces. And I had it working by having the user specify which JSF api and implementation .jar files to use, as properties: maven.shale.jsf.api.jar=${maven.repo.local}/myfaces/jars/myfaces-jsf-api-1.0 .9.jar maven.shale.jsf.impl.jar=${maven.repo.local}/myfaces/jars/myfaces-impl-1.0.9 .jar or maven.shale.jsf.api.jar=${maven.repo.local}/javax.faces/jars/jsf-api-1.1.jar maven.shale.jsf.impl.jar=${maven.repo.local}/javax.faces/jars/jsf-impl-1.1.j ar But then I found out that for MyFaces, there is a *third* .jar file that must be included in the .war file. So now (realizing that there's probably no way I can avoid a bunch of scripting) I'm thinking of having the user specify either: maven.shale.jsf = [myfaces|jsfri] or maven.shale.jsf.ri = [true|false] maven.shale.jsf.myfaces = [true|false] Before I go any further with that, is there a precedent I should follow? Alternately, because I can't specify "a" dependency in the project.xml file, I already wrote 'myfaces-project.xml' which does nothing but declare the dependencies so Maven will download them. Is it possible that the "right answer" is to have a 'myfaces-project.xml' file in each directory and do either $ maven build-all or $ maven -p myfaces-project.xml build-all depending on which JSF implementation you want to use? I'm not sure I want to start down that path, given that there may eventually be multiple JSF implementations from which to choose. What would you do in this situation? If you want to take a look at the files: http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/ or $ svn co http://svn.apache.org/repos/asf/struts/shale/trunk/ shale (If you want to try to build it, read this first: http://wiki.wsmoak.net/cgi-bin/wiki.pl?ShaleMavenBuild ) Thanks for any advice! I note that there is only one thread on this topic in the archives... one post, with no replies. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m1] Conditional dependencies
I'm working on a project that needs to compile and build with *either* the JSF Reference Implementation *or* Apache MyFaces. This has to be user-specified, at build time. In addition to compilation and including the correct .jar files in a webapp, there's also a modification that must be done to web.xml, commenting out a section if we're using the RI, leaving it in place for MyFaces. And I had it working by having the user specify which JSF api and implementation .jar files to use, as properties: maven.shale.jsf.api.jar=${maven.repo.local}/myfaces/jars/myfaces-jsf-api-1.0.9.jar maven.shale.jsf.impl.jar=${maven.repo.local}/myfaces/jars/myfaces-impl-1.0.9.jar or maven.shale.jsf.api.jar=${maven.repo.local}/javax.faces/jars/jsf-api-1.1.jar maven.shale.jsf.impl.jar=${maven.repo.local}/javax.faces/jars/jsf-impl-1.1.jar But then I found out that for MyFaces, there is a *third* .jar file that must be included in the .war file. So now (realizing that there's probably no way I can avoid a bunch of scripting) I'm thinking of having the user specify either: maven.shale.jsf = [myfaces|jsfri] or maven.shale.jsf.ri = [true|false] maven.shale.jsf.myfaces = [true|false] Before I go any further with that, is there a precedent I should follow? Alternately, because I can't specify "a" dependency in the project.xml file, I already wrote 'myfaces-project.xml' which does nothing but declare the dependencies so Maven will download them. Is it possible that the "right answer" is to have a 'myfaces-project.xml' file in each directory and do either $ maven build-all or $ maven -p myfaces-project.xml build-all depending on which JSF implementation you want to use? I'm not sure I want to start down that path, given that there may eventually be multiple JSF implementations from which to choose. What would you do in this situation? If you want to take a look at the files: http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/ or $ svn co http://svn.apache.org/repos/asf/struts/shale/trunk/ shale (If you want to try to build it, read this first: http://wiki.wsmoak.net/cgi-bin/wiki.pl?ShaleMavenBuild ) Thanks for any advice! I note that there is only one thread on this topic in the archives... one post, with no replies. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Conditional dependencies
I have a for an EJB jar that should only be present if packaging for the "WAS" userdefined goal. How may I include/exlude dependencies? Regards, Håkon Hallingstad Software Developer, EDB +47 2252 8218 [EMAIL PROTECTED] www.edb.com "IT er ikke alt - men det hjelper" - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]