Table of Contents | ||
---|---|---|
|
Descriptors
Maven update manager uses 3 different XML documents for it's operations
Version List or VL - stores information about all available versions. In case of Maven install - it describes all available Maven *CD*s
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <availableVersions> <scopes> <scope> <name>default</name> <versions> <version> <name>org.apache.maven:maven-cd:3.0-20081122.062742-13</name> </version> <version> <name>org.apache.maven:maven-cd:3.0-20081215.222827-14</name> </version> <version> <name>org.apache.maven:maven-cd:3.0-alpha-1</name> </version> </versions> </scope> </scopes> </availableVersions> |
Configuration Descriptor or CD - describes one particular version configuration. MP3 updater uses it for a list of dependency GAVs, that are used to calculate a full transitive closure for a given installation
Release is simple, just one entry point calculates into a full transitive closure
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <nodeConfig> <containers> <container> <id>apache-maven</id> <version>3.0-alpha-1</version> <type>maven</type> <distribution> <name>org.apache.maven:maven-distribution:3.0-alpha-1:bin:zip</name> </distribution> <dependencies> <dependency> <name>org.apache.maven:maven:3.0-alpha-1</name> </dependency> </dependencies> </container> </containers> </nodeConfig> |
For a snapshot - descriptor becomes a little more dense: because all snapshot dependencies of a timestamped snapshot are listed in the POM as -SNAPSHOT, they would resolve into a the latest timestamp and mess the closuer. To overcome this obstacle, you need to list all the timestaped dependencies in the CD, so that they win in the dependency resolution. Example of such a descriptor - below. MP3 also provides tool to help you calculate this list - see below.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <nodeConfig> <containers> <container> <id>apache-maven</id> <version>3.0-20081122.062742-13</version> <type>maven</type> <distribution> <name>org.apache.maven:maven-distribution:3.0-alpha-1:bin:zip</name> </distribution> <dependencies> <dependency><name>org.apache.maven:maven-core:3.0-20081122.062742-13::jar</name></dependency> <dependency><name>org.apache.maven.doxia:doxia-sink-api:1.0-alpha-9::jar</name></dependency> <dependency><name>org.codehaus.plexus:plexus-component-annotations:1.0-beta-3.0.5::jar</name></dependency> <dependency><name>commons-cli:commons-cli:1.0::jar</name></dependency> ............. <dependency><name>org.codehaus.woodstox:wstx-asl:3.2.6::jar</name></dependency> <dependency><name>org.apache.maven.shared:maven-shared-model:1.0-SNAPSHOT::jar</name></dependency> <dependency><name>stax:stax-api:1.0.1::jar</name></dependency> <dependency><name>org.sonatype.spice:model-builder:1.3::jar</name></dependency> <dependency><name>org.apache.maven:maven-compat:3.0-20090124.003749-12::jar</name></dependency> <dependency><name>org.apache.maven:maven-project-builder:3.0-20081120.183242-8::jar</name></dependency> </dependencies> </container> </containers> </nodeConfig> |
Lock Down List or LDL - expanded list of all the binaries in a version, used to capture calculated transitive closure. You will need to create one for your distribution. MP3 Updater needs it to get a list of all the binaries in the newly distributed version of Maven.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <lockDownList> <dependencies> <dependency> <name>org.apache.maven:maven-core:3.0-SNAPSHOT::jar</name> </dependency> <dependency> <name>org.apache.maven.doxia:doxia-sink-api:1.0-alpha-9::jar</name> </dependency> ........ <dependency> <name>org.codehaus.woodstox:wstx-asl:3.2.6::jar</name> </dependency> <dependency> <name>stax:stax-api:1.0.1::jar</name> </dependency> </dependencies> </lockDownList> |
How to add a version
From the description of the XML documents, it more or less clear how to add a new version to the list of available versions:
- add it to the list of available versions in the Version List, found at org.apache.maven:maven-versions:1.0::ver
- each version there points to a a GAV of a CD of that version, for example org.apache.maven:maven-cd:3.0-alpha-1, the type of this artifact should be cd, but you don't have to specify it - MP3 will do it for you.
- deploy CD to a repository and you are good to go.
MP3 tools to help creating descriptors
mvnUpdate -c GAV REGEX VERSION_FROM VERSION_TO -n, where
- GAV - GAV of the entry point artifact to create a closure for
- REGEX - regEx of a artifactId to match
- VERSION_FROM VERSION_TO - in the matched artifacts, if the have version VERSION_FROM, replace it with VERSION_TO, add this artifact to the list, and resolve again, untill no more matches are found.
- -n At the end, this CLI will try to resolve the binaries and fails if some of them are not found. Use this flag to turn off this download test.
For example
mvnUpdate -c org.apache.maven:maven-core:3.0-20090128.172840-19 maven-. 3.0-SNAPSHOT 3.0-20090128.172840-19* will iterate over the list of dependencies of org.apache.maven:maven-core:3.0-20090128.172840-19, and if there are artifacts matching maven-.*, replace version 3.0-SNAPSHOT to 3.0-20090128.172840-19, add to the list and try again.
New Maven distro
apache-maven project has a new folder: src/.cd, it contains 3 files descriptors. We'll be able to generate them later on, but now it is a manual operation.
If the current version is VERSION, these files are:
- apache-maven.cd and apache-maven-VERSION.cd two identical files that describe the current version
- apache-maven-VERSION.ldl the full lock down list for this version
These 3 files are included into distribution and are used to by the MP3 to correctly update this version.