Re: [proposal] - maven 2 based build?

From: Bill Dudney (bdudne..pache.org)
Date: Thu Feb 23 2006 - 16:44:39 EST

  • Next message: Malcolm Edgar: "Re: [proposal] - maven 2 based build?"

    Hi All,

    Sorry I forgot to send this initially to this list...

    My comments are interwoven...

    On Feb 23, 2006, at 9:43 AM, Andrus Adamchik wrote:

    > [I am forwarding this message to cayenne-devel with my comment.
    > Bill, I see you are subscribed to it already.]
    >
    > A few months ago we went through a big reorg of the build scripts
    > to better handle multiple subprojects (back then the driving force
    > was to be able to develop 1.4 and 1.5 builds in parallel). I am
    > very satisfied with what we have now, but I do realize that scaling
    > it to a larger number of subprojects can be tough.
    >
    > While we maybe looking for alternatives, my current concerns/
    > questions (many coming from total ignorance about maven) are the
    > following:
    >
    > 1. Unit tests DB switching. Will it be possible with Maven?
    >
    > http://objectstyle.org/confluence/display/CAY/Running+Unit+Tests
    >

    Slightly different implementation but same result.

    You would put the connection strings in $HOME/.m2/settings.xml

    http://maven.apache.org/maven-settings/settings.html

    and place your various properties in (pseudo xpath)

    /settings/profiles/profile/id="foo"/name="cayenne.adapter"
    /settings/profiles/profile/id="foo"/
    value="org.objectstyle.cayenne.dba.mysql.MySQLAdapter"
    /settings/profiles/profile/id="foo"/name="jdbc.username"
    /settings/profiles/profile/id="foo"/value="someuser"
    ...

    /settings/profiles/profile/id="bar"/name="cayenne.adapter"
    /settings/profiles/profile/id="bar"/
    value="org.objectstyle.cayenne.dba.oracle.OracleAdapter"
    /settings/profiles/profile/id="bar"/name="jdbc.username"
    /settings/profiles/profile/id="bar"/value="otheruser"
    ...

    then you can invoke the 'foo' connection via

    $mvn -P foo

    With this the value of 'cayenne.adapter' would be
    'o.o.c.d.mysql.MySQLAdapter'

    $mvn -P bar

    would yield 'cayenne.adapter' would be 'o.o.c.d.mysql.OracleAdapter'

    I'm not sure how to pass in different filters for the test classes to
    run but I expect that it would be possible with the same setup via
    the settings.xml file under a different profile. Then you can coma
    delimt the profiles to activate like this;

    $mvn -P bar,groovyTests

    > 2. Ant scripts are optimized to do things incrementally, so if I
    > need to run just a single test, I don't have to do the entire build
    > (maybe this concern will go away once I upgrade to the new Apple
    > MacBook? :-))
    >

    Yes MacBook Pro! that will solve everything! I'm waiting for the 17"
    though...

    Now on to the real issue... This is really a job well suited to
    TestNG, not JUnit and Ant file filters but that is a story for
    another day. I've not done this sort of thing with maven but I'd
    assume that we would set up a filter property in a profile and use
    that to filter out all other tests.

    > 3. Web site. While our current site may need improvement (see the
    > whole CMS thread - http://www.objectstyle.org/cayenne/lists/cayenne-
    > user/2005/10/0157.html ), I'd like to preserve the "branded" site,
    > just make it more flexible. Wouldn't switching to Maven-built site
    > take us further away from that goal?
    >

    Maven makes a great developer site and a moderately good user site.
    The maven site (http://maven.apache.org/) is a good representation of
    what is easy with maven. Other customizations are possible but not as
    easy. I think doing a reduex of the Cayenne site on the easy side of
    customization. I'll have a go at it some time soon and see what I can
    come up with :-)

    > 4. (showing my ignorance here) If dependencies are downloaded
    > during the build, how do we setup Eclipse to use the right
    > dependencies. Corollary to that - if we don't want to use the
    > latest version of some dependency package (e.g. cause it is not
    > widely deployed out there yet and is not fully backwards
    > compatible), can Maven handle that?
    >

    2 ways:
    1) $mvn eclipse:eclipse and then modify a 'build variable' in eclipse
    by setting M2_REPO (it typically is $HOME/.m2/repository)
    cool thing about this that mvn idea:idea and mvn netbeans:netbeans
    etc all work as well so developers can use any ide they want (I'm not
    sure of all the supported ones but eclpse, idea and netbeans have
    support).

    2) use the maven 2 plugin for eclipse, its very cool, works a lot
    like ant and makes your life easy

    > 5. If there is something Maven does not support is there a way to
    > plugin an Ant script in the build process?
    >

    There is a plugin that allows you to invoke ant from your maven2 build.

    http://maven.apache.org/plugins/maven-antrun-plugin/run-mojo.html

    I've not used it but Matt Raible has and I can always go make him
    explain it :-)

    > As you see all of these concerns are about loosing flexibility that
    > Ant presently gives us. So maybe lets try Maven with cayenne-jpa to
    > get a feel of what it is, but I'd postpone the discussion of
    > migration of the main Cayenne build system till at least after 1.2.
    >
    > Right now cayenne-jpa project has no consistent build system. I was
    > going to write an Ant-based script very soon (CAY-459 task). So
    > Bill, would it be possible to set up something Maven-based quickly
    > for the JPA work?
    >

    Ok I need to get cracking!

    TTFN,

    -bd-

    > Andrus
    >
    >
    >
    > On Feb 23, 2006, at 7:29 AM, Bill Dudney wrote:
    >> Hi All,
    >>
    >> I wanted to start a thread on this topic.
    >>
    >> I was wondering what the dev community interest is on moving to m2
    >> for at least the cayenne jpa stuff.
    >>
    >> I have been involved in a couple of m2 moves and would be glad to
    >> help out with this on Cayenne.
    >>
    >> Benefits as I see them;
    >> 1) automated build without reliance on properties files
    >> 2) easy to package various builds in one invocation (i.e. linux,
    >> windows, osx builds in one invocation of m2)
    >> 3) Simplified site building and deploying
    >> 4) makes it much easier to get an m2 repository for people to use
    >> maven with Cayenne
    >>
    >> Downside:
    >> 1) directory layout should match the m2 expected dir structure for
    >> maximum benifit
    >> 2) m2 is not as familiar so some people that want to download and
    >> build cayenne themselves might be turned off
    >> 3) the ibiblio repo can be very slow and make maven very slow
    >>
    >> There are probably lots of others on both the + and - side.
    >>
    >> Thoughts?
    >>
    >> Bill Dudney
    >> MyFaces - myfaces.apache.org
    >> Wadi - incubator.apache.org/wadi
    >



    This archive was generated by hypermail 2.0.0 : Thu Feb 23 2006 - 16:44:54 EST