Re: Documentation on Maven Archetypes

From: Lachlan Deck (lachlan.dec..mail.com)
Date: Tue Nov 18 2008 - 05:57:00 EST

  • Next message: René Bock: "Entity Modeler and new UserInfo Editor"

    On 18/11/2008, at 8:13 PM, Juergen Lorenz Simon wrote:

    > On 17.11.2008, at 21:13, Lachlan Deck wrote:
    >
    >> On 17/11/2008, at 10:31 PM, Juergen Lorenz Simon wrote:
    >>
    >>> I've been trying to get Maven integration up for some projects. I
    >>> found a few
    >>> rough edges in the documentation, especially the Wiki.
    >>
    >> Feel free to contribute where applicable.
    >
    > Once I wrapped my head around it and stop asking stupid questions.

    Sure. No worries.

    >>> - After adding the archetypes to the archetype-catalog.xml, I was
    >>> unable to
    >>> create projects from archetypes. I found out, that i need to add
    >>> a repository
    >>> (not just pluginRepository) to the .m2/settings.xml.
    >>
    >> No. This is only needed in your project's pom file (which can be
    >> better as it's kept within your version control). Maven doesn't
    >> need to know about your repositories - though there's no harm in
    >> doing so - for you to be able to generate the project AFAIK.
    >
    > I understand. However, somehow this does not work for me.

    Hmm. Works for me.

    $ mvn archetype:generate -DarchetypeArtifactId=woapplication-archetype
    -DarchetypeGroupId=org.objectstyle.woproject.maven2 -
    DarchetypeVersion=2.0.16 -DarchetypeRepository=http://webobjects.mdimension.com/maven2/releases
    [INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'archetype'.
    [INFO] org.objectstyle.woproject.maven2: checking for updates from
    mdimension.releases
    [INFO] org.objectstyle.woproject.maven2: checking for updates from
    central
    [INFO] org.apache.maven.plugins: checking for updates from
    mdimension.releases
    [INFO] org.codehaus.mojo: checking for updates from mdimension.releases
    [INFO] artifact org.apache.maven.plugins:maven-archetype-plugin:
    checking for updates from mdimension.releases
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Building Maven Default Project
    [INFO] task-segment: [archetype:generate] (aggregator-style)
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Preparing archetype:generate
    [INFO] No goals needed for project - skipping
    [INFO] Setting property: classpath.resource.loader.class =>
    'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
    [INFO] Setting property: velocimacro.messages.on => 'false'.
    [INFO] Setting property: resource.loader => 'classpath'.
    [INFO] Setting property: resource.manager.logwhenfound => 'false'.
    [INFO] [archetype:generate]
    [INFO] Generating project in Interactive mode
    [INFO] Archetype defined by properties
    Define value for groupId: : to.bug.or.not
    Define value for artifactId: : to.bug
    Define value for version: 1.0-SNAPSHOT: :
    Define value for package: : bug.package
    Confirm properties configuration:
    WebObjectsVersion: 5.4.2
    WonderSupport: no
    WonderVersion: 5.0.0-SNAPSHOT
    TrueWarSupport: no
    groupId: to.bug.or.not
    artifactId: to.bug
    version: 1.0-SNAPSHOT
    package: bug.package
      Y: :
    [INFO]
    ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Total time: 59 seconds
    [INFO] Finished at: Tue Nov 18 21:34:23 EST 2008
    [INFO] Final Memory: 8M/15M
    [INFO]
    ------------------------------------------------------------------------
    ldecks-macbook-pro:WOTests ldeck$

    And just to prove the point...

    ldecks-macbook-pro:WOTests ldeck$ mv ~/.m2 ~/.m2-tmp
    ldecks-macbook-pro:WOTests ldeck$ mkdir ~/.m2
    ldecks-macbook-pro:WOTests ldeck$ cp /Users/ldeck/.m2-tmp/settings.xml
    ~/.m2/
    ldecks-macbook-pro:WOTests ldeck$ mvn archetype:generate -
    DarchetypeArtifactId=woapplication-archetype -
    DarchetypeGroupId=org.objectstyle.woproject.maven2 -
    DarchetypeVersion=2.0.16 -DarchetypeRepository=http://webobjects.mdimension.com/maven2/releases
    [INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'archetype'.
    [INFO] org.objectstyle.woproject.maven2: checking for updates from
    mdimension.releases
    [INFO] org.objectstyle.woproject.maven2: checking for updates from
    central
    [INFO] org.apache.maven.plugins: checking for updates from
    mdimension.releases
    [INFO] org.apache.maven.plugins: checking for updates from central
    [INFO] org.codehaus.mojo: checking for updates from mdimension.releases
    [INFO] org.codehaus.mojo: checking for updates from central
    [INFO] artifact org.apache.maven.plugins:maven-archetype-plugin:
    checking for updates from mdimension.releases
    [INFO] artifact org.apache.maven.plugins:maven-archetype-plugin:
    checking for updates from central
    Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/2.0-alpha-4/maven-archetype-plugin-2.0-alpha-4.pom
    4K downloaded
    <...>
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Building Maven Default Project
    [INFO] task-segment: [archetype:generate] (aggregator-style)
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Preparing archetype:generate
    [INFO] No goals needed for project - skipping
    Downloading: http://webobjects.mdimension.com/maven2/releases/org/apache/maven/archetype/archetype-common/2.0-alpha-4/archetype-common-2.0-alpha-4.pom
    Downloading: http://repo1.maven.org/maven2/org/apache/maven/archetype/archetype-common/2.0-alpha-4/archetype-common-2.0-alpha-4.pom
    15K downloaded
    Downloading: http://webobjects.mdimension.com/maven2/releases/org/apache/maven/maven-core/2.0.8/maven-core-2.0.8.pom
    Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-core/2.0.8/maven-core-2.0.8.pom
    6K downloaded
    <...>
    [INFO] Setting property: classpath.resource.loader.class =>
    'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
    [INFO] Setting property: velocimacro.messages.on => 'false'.
    [INFO] Setting property: resource.loader => 'classpath'.
    [INFO] Setting property: resource.manager.logwhenfound => 'false'.
    [INFO] [archetype:generate]
    [INFO] Generating project in Interactive mode
    [INFO] Archetype defined by properties
    Downloading: http://webobjects.mdimension.com/maven2/releases/org/objectstyle/woproject/maven2/woapplication-archetype/2.0.16/woapplication-archetype-2.0.16.jar
    20K downloaded
    Define value for groupId: : still.no.bug
    Define value for artifactId: : fresh.is.fine
    Define value for version: 1.0-SNAPSHOT: :
    Define value for package: still.no.bug: :
    Confirm properties configuration:
    WebObjectsVersion: 5.4.2
    WonderSupport: no
    WonderVersion: 5.0.0-SNAPSHOT
    TrueWarSupport: no
    groupId: still.no.bug
    artifactId: fresh.is.fine
    version: 1.0-SNAPSHOT
    package: still.no.bug
      Y: :
    [WARNING] org.apache.velocity.runtime.exception.ReferenceException:
    reference : template = archetype-resources/pom.xml [line 40,column
    34] : ${woversion} is not a valid reference.
    [WARNING] org.apache.velocity.runtime.exception.ReferenceException:
    reference : template = archetype-resources/pom.xml [line 45,column
    34] : ${woversion} is not a valid reference.
    [WARNING] org.apache.velocity.runtime.exception.ReferenceException:
    reference : template = archetype-resources/pom.xml [line 50,column
    34] : ${woversion} is not a valid reference.
    [INFO]
    ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Total time: 11 minutes 7 seconds
    [INFO] Finished at: Tue Nov 18 21:52:38 EST 2008
    [INFO] Final Memory: 8M/15M
    [INFO]
    ------------------------------------------------------------------------

    > When generating the
    > archetype, maven seemed to wantin' downloadin' something (for the
    > archetype) and
    > could not find it. That is why I added it to the local repository's
    > settings.xml. I was
    > creating the archetypes from the command line, if that makes any
    > difference.
    >
    >>> And in the bottom section of my settings.xml, I found the
    >>> following section
    >>> where something needed adding:
    >>>
    >>> <activeProfiles>
    >>> <activeProfile>xwiki</activeProfile>
    >>> <activeProfile>webobjects</activeProfile>
    >>> </activeProfiles>
    >>
    >> Where'd you get that from?
    >
    > I did not start setting Maven up from the WOLips side of things. I'm
    > integrating XWiki
    > into a WebObjects project. So my first contact with the Maven setup
    > was the Xwiki's
    > guide, and that included this section. I found that when I got
    > multiple profiles and do
    > not add them to the list of active profiles, they are not used.
    > Maybe that only applies
    > if you actually have that section.

    http://maven.apache.org/ref/2.0.9/maven-settings/settings.html
    Yep - you can dump that section and allow it to rely on each profile's
    activation. You only need that, it seems, if you need to specify the
    order in which the profiles ought to be used. But if you keep it -
    you'll have to maintain it naturally.

    > I'm still quite new to the Maven business.

    Understood :-)

    with regards,

    --
    

    Lachlan Deck



    This archive was generated by hypermail 2.0.0 : Tue Nov 18 2008 - 05:58:06 EST