Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Maven2 dependency management and profiles

  • 25-09-2009 10:48am
    #1
    Registered Users, Registered Users 2 Posts: 2,800 ✭✭✭


    Bit of a long shot - but maybe someone has come across this before.

    Basically I have 3 projects
    db
    middleware
    UI

    Everything build using continuum +maven2

    I use profiles to create a db-dev and db-release jar. The db-dev.jar has the configuration for connecting to development database. and the db-release.jar has the configuration for production database.

    So I have the middleware project with a dependency on the db project (in the pom). If I use the release profile, the middleaware project builds with the db-release.jar otherwise it builds with the db-dev.jar.

    Up to this stage all works fine - I can build dev or release versions of middleware and will the get db-dev.jar or db-release.jar depending on the profile used.

    Now the UI is a web app and is packaged as a war. Here in the pom, Ive set the profile again for production but what I get in the WEB-INF/lib folder is the middleware-dev.jar,middleware-release.jar and db-dev.jar


    It seems that the profile works for the first level of dependencies (although I shouldnt be getting the two middleware jars - but thats a problem for another day), but not the second level.

    Anyone got any tips on how to sort this out ?


Comments

  • Registered Users, Registered Users 2 Posts: 2,800 ✭✭✭voxpop


    Solved the issue myself in the end.

    What I did was change how the profile was activated (-Denv=prod) and added another dev profile that was activated when no env parameter.

    This then gave me the release and dev jars in the final build. What Id assumed was that the dependency in the profile would override a "default" dependence (they are exactly the same bar the classifier) - it doesnt.

    Anyway I removed the dependency from the main section of the pom and added the particular classifier to each dependency in the separate profiles.

    All works now :)


Advertisement