r4 - 21 Oct 2005 - 10:55:37 - MikeTYou are here: OSAF >  Journal Web  >  TWikiUsers > MikeT > MikeTaylorNotes > Maven2Upgrade

Maven 2.0 migration

This is where I will be outlining any notes, gotchas and/or info on the migration to Maven 2.0 for the Cosmo and Scooby project

Links of Interest

Notes

What they don't tell you in the very sparse Getting Started docs

Ok, just learned a big lesson - Maven2 (aka m2 aka mvn) will not download or create it's environment cleanly if you try to run it within a Maven1 project. It seems to process the project.xml (even tho it's not pom.xml) and fails with some cryptic "I can't download something or the other ... waaaa" message.

What you need to do is go somewhere safe and quiet and tell Maven2 to build a new empty project:

    mvn archetype:create -c -DgroupID=org.osaf.cosmo -DarifactId=cosmo

The -c is important - it tells Maven2 to not fail if the checksum fails - evidently even Apache has trouble with md5 like we do.

This will cause Maven2 to download all the nifty plugins that came with Maven1 but now are not bundled. It will next place them in their proper places and build you an empty pom.xml and project directory structure.

project.xml items that Maven2 doesn't seem to like within pom.xml

logo, inceptionYear, issueTrackingUrl

within a dependency: properties

remote repositories

In Maven1 they are specified in project.properties, but in Maven2 they /can/ be specified in pom.xml -- see Guide to Using Multiple Repositories

To get Maven2 to pull from a Maven1 respository add <layout>legacy</layout> to the <repository> entry.

Maven2 repositories are not structured the same as Maven1

In Maven1, the structure looks like this:

    maven/
        osaf-commons/
            jars/
                osaf-commons-struts-0.1.jar
                osaf-commons-struts-0.2.jar
            plugins/
            poms/
                osaf-commons-struts-0.1.pom
                osaf-commons-struts-0.2.pom

Where Maven2 seems (I am still working on the details for this) to be:

    maven2/
        osaf-commons/
            maven-metadata.xml
            osaf-commons-struts/
                0.2/
                    osaf-commons-struts-0.2.jar
                    osaf-commons-struts-0.2.pom

The magic seems to happen within the maven-metadata.xml file and I think the individual .pom files are also different but I'm not sure. Here is an example of a maven.metadata.xml (this is from http://www.ibiblio.org/maven2/jcs/jcs/ )

<metadata>
  <groupId>jcs</groupId>
  <artifactId>jcs</artifactId>
  <version>1.0-dev</version>
  <versioning>
    <versions>
      <version>1.0-dev</version>
      <version>1.0-dev.20020801.123921</version>
      <version>1.0-dev.20020801.125151</version>
      <version>20030822.182132</version>
    </versions>
  </versioning>
</metadata>
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.