Skip to content

Commit

Permalink
Build Modello improvement, change namespace for xsd
Browse files Browse the repository at this point in the history
- all Modello source will have the same version of model
- generate Modello documentation in model directory - we have the same report name as documentation for model
- change name space to https://www.mojohaus.org/VERSIONS/...
- preserver old version of rule.xsd
  • Loading branch information
slawekjaranowski committed Oct 20, 2022
1 parent 12ea57c commit 4cd4065
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 38 deletions.
31 changes: 5 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@
<artifactId>modello-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-rule</id>
<phase>generate-sources</phase>
<id>generate-source</id>
<goals>
<!-- Generate the xpp3 reader code -->
<goal>xpp3-reader</goal>
Expand All @@ -323,36 +322,16 @@
<!-- Generate the Java sources for the model itself -->
<goal>java</goal>
</goals>
<configuration>
<models>
<model>src/main/mdo/rule.mdo</model>
</models>
<version>2.0.0</version>
</configuration>
</execution>
<execution>
<id>generate-reporting</id>
<phase>generate-sources</phase>
<goals>
<!-- Generate the writer code -->
<goal>xpp3-writer</goal>
<!-- Generate the Java sources for the model itself -->
<goal>java</goal>
</goals>
<configuration>
<models>
<model>src/main/mdo/dependency-updates-report.mdo</model>
<model>src/main/mdo/plugin-updates-report.mdo</model>
</models>
<version>2.0.0</version>
</configuration>
</execution>
<execution>
<id>site-doc</id>
<phase>pre-site</phase>
<goals>
<goal>xdoc</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-site/xdoc/model</outputDirectory>
</configuration>
</execution>
<execution>
<id>site-xsd</id>
Expand All @@ -371,7 +350,7 @@
<model>src/main/mdo/dependency-updates-report.mdo</model>
<model>src/main/mdo/plugin-updates-report.mdo</model>
</models>
<version>2.0.0</version>
<version>2.1.0</version>
</configuration>
</plugin>
<plugin>
Expand Down
4 changes: 2 additions & 2 deletions src/main/mdo/dependency-updates-report.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ under the License.

<model xmlns="http://codehaus-plexus.github.io/MODELLO/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/2.0.0 https://codehaus-plexus.github.io/modello/xsd/modello-2.0.0.xsd"
xsd.namespace="http://mojo.codehaus.org/versions-maven-plugin/dependency-updates-report/1.0.0"
xsd.targetNamespace="http://mojo.codehaus.org/versions-maven-plugin/dependency-updates-report/1.0.0">
xml.namespace="https://www.mojohaus.org/VERSIONS/DEPENDENCY-UPDATES-REPORT/${version}"
xml.schemaLocation="https://www.mojohaus.org/versions-maven-plugin/xsd/dependency-updates-report-${version}.xsd">
<id>dependency-updates-report</id>
<name>DependencyUpdatesReport</name>
<description>
Expand Down
4 changes: 2 additions & 2 deletions src/main/mdo/plugin-updates-report.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ under the License.

<model xmlns="http://codehaus-plexus.github.io/MODELLO/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/2.0.0 https://codehaus-plexus.github.io/modello/xsd/modello-2.0.0.xsd"
xsd.namespace="http://mojo.codehaus.org/versions-maven-plugin/plugin-updates-report/1.0.0"
xsd.targetNamespace="http://mojo.codehaus.org/versions-maven-plugin/plugin-updates-report/1.0.0">
xml.namespace="https://www.mojohaus.org/VERSIONS/PLUGIN-UPDATES-REPORT/${version}"
xml.schemaLocation="https://www.mojohaus.org/versions-maven-plugin/xsd/plugin-updates-report-${version}.xsd">
<id>plugin-updates-report</id>
<name>PluginUpdatesReport</name>
<description>
Expand Down
4 changes: 2 additions & 2 deletions src/main/mdo/rule.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ under the License.

<model xmlns="http://codehaus-plexus.github.io/MODELLO/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/2.0.0 https://codehaus-plexus.github.io/modello/xsd/modello-2.0.0.xsd"
xsd.namespace="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
xsd.targetNamespace="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0">
xml.namespace="https://www.mojohaus.org/VERSIONS/RULE/${version}"
xml.schemaLocation="https://www.mojohaus.org/versions-maven-plugin/xsd/rule-${version}.xsd">
<id>rule</id>
<name>Rule</name>
<description>
Expand Down
8 changes: 4 additions & 4 deletions src/site/markdown/version-rules.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ it otherwise.
Rules.xml
---------

To specify the version schemes to use, you may define a [rule-set xml file](./rule.html), use the `ruleSet`
To specify the version schemes to use, you may define a [rule-set xml file](./model/rule.html), use the `ruleSet`
element in the `versions-maven-plugin` plugin configuration, or specify ignored versions via
the `maven.version.ignore` property.

Expand All @@ -68,8 +68,8 @@ The `rules.xml` file should conform to the xsd specified in the example below.

```xml
<ruleset comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 https://www.mojohaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
xmlns="https://www.mojohaus.org/VERSIONS/RULE/2.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.mojohaus.org/VERSIONS/RULE/2.1.0 https://www.mojohaus.org/versions-maven-plugin/xsd/rule-2.1.0.xsd">
<rules>
<rule groupId="*.maven" comparisonMethod="mercury"/>
<rule groupId="com.mycompany" comparisonMethod="numeric"/>
Expand All @@ -79,7 +79,7 @@ The `rules.xml` file should conform to the xsd specified in the example below.
</ruleset>
```

The rule-set files must match the [XSD schema](./xsd/rule-2.0.0.xsd).
The rule-set files must match the [XSD schema](./xsd/index.html).

You can then use the `rulesUri` parameter to specify the rule-set to be used by the
`versions-maven-plugin`.
Expand Down
20 changes: 20 additions & 0 deletions src/site/markdown/xsd/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
title: XML schemas
author: Slawomir Jaranowski
date: 2022-10-17

<!-- GitHub pages doesn't generate index page ... we need prepare one -->

# Versions - XML schemas

## dependency-updates-report.xsd

- [dependency-updates-report-2.1.0.xsd](dependency-updates-report-2.1.0.xsd)

## plugin-updates-report.xsd

- [plugin-updates-report-2.1.0.xsd](plugin-updates-report-2.1.0.xsd)

## rule.xsd

- [rule-2.0.0.xsd](rule-2.0.0.xsd)
- [rule-2.1.0.xsd](rule-2.1.0.xsd)
116 changes: 116 additions & 0 deletions src/site/resources/xsd/rule-2.0.0.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0"?>
<!-- =================== DO NOT EDIT THIS FILE ==================== -->
<!-- Generated by Modello 2.0.0, -->
<!-- any modifications will be overwritten. -->
<!-- ============================================================== -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" targetNamespace="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0">
<xs:element name="ruleset" type="RuleSet">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
Describes a set of rules for how versions of artifacts should be handled.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="RuleSet">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
Describes a set of rules for how versions of artifacts should be handled.
</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element minOccurs="0" name="ignoreVersions">
<xs:annotation>
<xs:documentation source="version">2.0.0+</xs:documentation>
<xs:documentation source="description">Version patterns to ignore for all artifacts.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="ignoreVersion" minOccurs="0" maxOccurs="unbounded" type="IgnoreVersion"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="rules">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="rule" minOccurs="0" maxOccurs="unbounded" type="Rule"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="comparisonMethod" type="xs:string" use="required">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">The comparison method to use when no rule matches.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="IgnoreVersion">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:annotation>
<xs:documentation source="version">2.0.0+</xs:documentation>
<xs:documentation source="description">A version to ignore.</xs:documentation>
</xs:annotation>
<xs:attribute name="type" type="xs:string" default="exact" use="optional">
<xs:annotation>
<xs:documentation source="version">2.0.0+</xs:documentation>
<xs:documentation source="description">The type of ignore mechanism to use. Allowed values are &apos;exact&apos; and &apos;regex&apos;.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="Rule">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
Describes a rule for how versions of artifacts should be handled.
</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element minOccurs="0" name="ignoreVersions">
<xs:annotation>
<xs:documentation source="version">2.0.0+</xs:documentation>
<xs:documentation source="description">Version patterns to ignore for this rule.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="ignoreVersion" minOccurs="0" maxOccurs="unbounded" type="IgnoreVersion"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="groupId" type="xs:string" use="required">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
The for groupId to which this rule applies. Wildcards with ? and * are valid.
A rule applies to all child groupIds unless overridden by a subsequent rule.
A rule without wildcards will override a rule with wildcards.
A rule with ? wildcards will override a rule with * wildcards.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="artifactId" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
The artifactId to which this rule applies. Wildcards with ? and * are valid.
A rule without wildcards will override a rule with wildcards.
A rule with ? wildcards will override a rule with * wildcards.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="comparisonMethod" type="xs:string" use="required">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">The comparison method that this rule specifies.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:schema>
4 changes: 2 additions & 2 deletions src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<item name="Changing aggregator project version" href="examples/setaggregator.html"/>
</menu>
<menu name="Reference">
<item name="Version number comparison rule-sets" href="rule.html"/>
<item name="XML schema for rules.xml" href="xsd/rule-2.0.0.xsd"/>
<item name="Version number comparison rule-sets" href="model/rule.html"/>
<item name="XML schemas" href="xsd/index.html"/>
</menu>
</body>
</project>

0 comments on commit 4cd4065

Please sign in to comment.