diff --git a/modello-plugins/modello-plugin-xsd/src/main/java/org/codehaus/modello/plugin/xsd/XsdGenerator.java b/modello-plugins/modello-plugin-xsd/src/main/java/org/codehaus/modello/plugin/xsd/XsdGenerator.java index 21efc9dd8..0fa441f7d 100644 --- a/modello-plugins/modello-plugin-xsd/src/main/java/org/codehaus/modello/plugin/xsd/XsdGenerator.java +++ b/modello-plugins/modello-plugin-xsd/src/main/java/org/codehaus/modello/plugin/xsd/XsdGenerator.java @@ -422,6 +422,10 @@ private static void writePropertiesElement(XMLWriter w) { w.endElement(); + w.startElement("xs:anyAttribute"); + w.addAttribute("processContents", "skip"); + w.endElement(); + w.endElement(); } diff --git a/modello-plugins/modello-plugin-xsd/src/test/java/org/codehaus/modello/plugin/xsd/XsdGeneratorMaven2Test.java b/modello-plugins/modello-plugin-xsd/src/test/java/org/codehaus/modello/plugin/xsd/XsdGeneratorMaven2Test.java new file mode 100644 index 000000000..c3d46de59 --- /dev/null +++ b/modello-plugins/modello-plugin-xsd/src/test/java/org/codehaus/modello/plugin/xsd/XsdGeneratorMaven2Test.java @@ -0,0 +1,50 @@ +package org.codehaus.modello.plugin.xsd; + +/* + * Copyright (c) 2005, Codehaus.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import java.util.Map; + +import org.codehaus.modello.AbstractModelloGeneratorTest; +import org.codehaus.modello.core.ModelloCore; +import org.codehaus.modello.model.Model; + +/** + * @author Brett Porter + */ +public class XsdGeneratorMaven2Test extends AbstractModelloGeneratorTest { + + public XsdGeneratorMaven2Test() { + super("xsd"); + } + + public void testXsdGenerator() throws Throwable { + ModelloCore modello = (ModelloCore) lookup(ModelloCore.ROLE); + + Model model = modello.loadModel(getXmlResourceReader("/maven2.mdo")); + + // generate XSD file + Map parameters = getModelloParameters("4.1.0"); + + modello.generate(model, "xsd", parameters); + } +} diff --git a/modello-plugins/modello-plugin-xsd/src/test/resources/maven2.mdo b/modello-plugins/modello-plugin-xsd/src/test/resources/maven2.mdo new file mode 100644 index 000000000..1404c9788 --- /dev/null +++ b/modello-plugins/modello-plugin-xsd/src/test/resources/maven2.mdo @@ -0,0 +1,3328 @@ + + + + + + + maven + Maven + + This is a reference for the Maven project descriptor used in Maven.

+

An XSD is available at:

+ + ]]> +
+ + + package + org.apache.maven.model + + + + + Model + ModelBase + + The {@code <project>} element is the root of the descriptor. + The following table lists all of the possible child elements. + + 3.0.0+ + + + + pomFile + 4.1.0+ + false + Originating POM file + DOM + + + + + + + + modelVersion + 4.0.0+ + true + Declares to which version of project descriptor this POM conforms. + String + + + + + + + + parent + 4.0.0+ + The location of the parent project, if one exists. Values from the parent + project will be the default for this project if they are left unspecified. The location + is given as a group ID, artifact ID and version. + + Parent + + + + + + + + + groupId + 3.0.0+ + true + + A universally unique identifier for a project. It is normal to + use a fully-qualified package name to distinguish it from other + projects with a similar name (eg. {@code org.apache.maven}). + + String + + + artifactId + 3.0.0+ + true + The identifier for this artifact that is unique within the group given by the + group ID. An artifact is something that is either produced or used by a project. + Examples of artifacts produced by Maven for a project include: JARs, source and binary + distributions, and WARs. + String + + + version + 4.0.0+ + true + The current version of the artifact produced by this project. + String + + + packaging + 4.0.0+ + + The type of artifact this project produces, for example {@code jar}, + {@code war}, + {@code ear}, + {@code pom}. + Plugins can create their own packaging, and + therefore their own packaging types, + so this list does not contain all possible types. + + String + jar + + + + + + + + name + 3.0.0+ + true + The full name of the project. + String + + + description + 3.0.0+ + A detailed description of the project, used by Maven whenever it needs to + describe the project, such as on the website. While this element can be specified as + CDATA to enable the use of HTML tags within the description, it is discouraged to allow + plain text representation. If you need to modify the index page of the generated website, + you are able to specify your own instead of adjusting this text. + String + + + url + 3.0.0+ + + Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + project's {@code child.project.url.inherit.append.path="false"}

+ ]]> +
+ String +
+ + childProjectUrlInheritAppendPath + 4.0.0+ + + Default value is: {@code true}

+ @since Maven 3.6.1 + ]]> +
+ String +
+ + root + 4.1.0+ + + Indicates that this project is the root project, located in the upper directory of the source tree. + This is the directory which may contain the .mvn directory. + + @since Maven 4.0.0 + + boolean + false + + + preserveModelVersion + 4.1.0+ + + Indicates if the build POM for this project should be preserved or downgraded to the lowest + compatible version. + @since Maven 4.0.0 + + boolean + false + + + inceptionYear + 3.0.0+ + true + The year of the project's inception, specified with 4 digits. This value is + used when generating copyright notices as well as being informational. + String + + + organization + 3.0.0+ + This element describes various attributes of the organization to which the + project belongs. These attributes are utilized when documentation is created (for + copyright notices and links). + organisation + + Organization + + + + licenses + 3.0.0+ + + + + + License + * + + + + developers + 3.0.0+ + Describes the committers of a project. + + Developer + * + + + + contributors + 3.0.0+ + Describes the contributors to a project that are not yet committers. + + Contributor + * + + + + mailingLists + 3.0.0+ + Contains information about a project's mailing lists. + + MailingList + * + + + + + + + + + prerequisites + 4.0.0+ + Describes the prerequisites in the build environment for this project. + + Prerequisites + + + + + + + + + scm + 4.0.0+ + Specification for the SCM used by the project, such as CVS, Subversion, etc. + + Scm + + + + + + + + + issueManagement + 4.0.0+ + The project's issue management system information. + + IssueManagement + + + + + + + + + ciManagement + 4.0.0+ + The project's continuous integration information. + + CiManagement + + + + + + + + + build + 3.0.0+ + true + Information required to build the project. + + Build + + + + + + + + + profiles + 4.0.0+ + A listing of project-local build profiles which will modify the build process + when activated. + + Profile + * + + +
+ + + 4.0.0/4.0.99 + + + + + + 4.1.0+ + + + + + +
+ + ModelBase + 3.0.0+ + + Base class for the {@code Model} and the {@code Profile} objects. + + + + modules + 4.0.0/4.1.0 + + @deprecated Use {@link #subprojects} instead. + + + String + * + + + @Deprecated + + + + subprojects + 4.1.0 + The subprojects (formerly called modules) to build as a part of this + project. Each subproject listed is a relative path to the directory containing the subproject. + To be consistent with the way default URLs are calculated from parent, it is recommended + to have subproject names match artifact ids. + + String + * + + + + distributionManagement + 4.0.0+ + Distribution information for a project that enables deployment of the site + and artifacts to remote web servers and repositories respectively. + + DistributionManagement + + + + properties + 4.0.0+ + + Properties that can be used throughout the POM as a substitution, and + are used as filters in resources if enabled. + The format is {@code <name>value</name>}. + + Properties + + String + * + + + + dependencyManagement + 4.0.0+ + false + Default dependency information for projects that inherit from this one. The + dependencies in this section are not immediately resolved. Instead, when a POM derived + from this one declares a dependency described by a matching groupId and artifactId, the + version and other values from this section are used for that dependency if they were not + already specified. + + DependencyManagement + + + + dependencies + 3.0.0+ + + This element describes all the dependencies associated with a project. + These dependencies are used to construct a classpath for your + project during the build process. They are automatically downloaded from the + repositories defined in this project. + + @see <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">Dependency mechanism</a> + + + Dependency + * + + + + repositories + 4.0.0+ + The lists of the remote repositories for discovering dependencies and + extensions. + + Repository + * + + + + pluginRepositories + 4.0.0+ + The lists of the remote repositories for discovering plugins for builds and + reports. + + Repository + * + + + + reports + 4.0.0 + + @deprecated Now ignored by Maven. + + DOM + + + reporting + 4.0.0+ + + This element includes the specification of report plugins to use + to generate the reports on the Maven-generated site. + These reports will be run when a user executes {@code mvn site}. + All the reports will be included in the navigation bar for browsing. + + + Reporting + + + + + + PluginContainer + 3.0.0+ + Contains the plugins information for the project. + + + plugins + 4.0.0+ + The list of plugins to use. + + Plugin + * + + + + + + 4.0.0/4.0.99 + + getPluginsAsMap() { + return getPlugins().stream().collect(Collectors.toMap(plugin -> plugin.getKey(), plugin -> plugin)); + } + ]]> + + + + 4.1.0+ + + pluginMap; + + /** + * @return a Map of plugins field with {@code Plugins#getKey()} as key + * @see Plugin#getKey() + */ + public Map getPluginsAsMap() { + if (pluginMap == null) { + synchronized (this) { + if (pluginMap == null) { + pluginMap = ImmutableCollections.copy(plugins.stream().collect( + java.util.stream.Collectors.toMap( + Plugin::getKey, java.util.function.Function.identity()))); + } + } + } + return pluginMap; + } + ]]> + + + + 4.0.0+ + + + + + + + + PluginConfiguration + 3.0.0+ + PluginContainer + Contains the plugins management information for the project. + + + + pluginManagement + 4.0.0+ + false + Default plugin information to be made available for reference by projects + derived from this one. This plugin configuration will not be resolved or bound to the + lifecycle unless referenced. Any local configuration for a given plugin will override + the plugin's entire definition here. + + PluginManagement + + + + + + 4.0.0+ + + + + + + + + BuildBase + 3.0.0+ + PluginConfiguration + Build configuration in a profile. + + + defaultGoal + 3.0.0+ + The default goal (or phase in Maven 2) to execute when none is specified for + the project. Note that in case of a build with subprojects, only the default goal of the top-level + project is relevant, i.e. the default goals of subprojects are ignored. Since Maven 3, + multiple goals/phases can be separated by whitespace. + String + + + resources + 3.0.0+ + + This element describes all the classpath resources such as properties + files associated with a project. These resources are often included in the final + package. + The default value is {@code src/main/resources}. + + + Resource + * + + + + testResources + 4.0.0+ + + This element describes all the classpath resources such as properties + files associated with a project's unit tests. + The default value is {@code src/test/resources}. + + + Resource + * + + + + directory + 4.0.0+ + + The directory where all files generated by the build are placed. + The default value is {@code target}. + + String + + + finalName + 4.0.0+ + + The filename (excluding the extension, and with no path information) that + the produced artifact will be called. + The default value is {@code ${artifactId}-${version}}. + + String + + + filters + 4.0.0+ + The list of filter properties files that are used when filtering is enabled. + + String + * + + + + + + 4.0.0+ + + + + + + + + Build + 3.0.0+ + BuildBase + + The {@code <build>} element contains information required to build the project. + Default values are defined in Super POM. + + + + sourceDirectory + 3.0.0+ + true + + This element specifies a directory containing the source of the project. The + generated build system will compile the sources from this directory when the project is + built. The path given is relative to the project descriptor. + The default value is {@code src/main/java}. + + String + + + scriptSourceDirectory + 4.0.0+ + true + + This element specifies a directory containing the script sources of the + project. This directory is meant to be different from the sourceDirectory, in that its + contents will be copied to the output directory in most cases (since scripts are + interpreted rather than compiled). + The default value is {@code src/main/scripts}. + + String + + + testSourceDirectory + 4.0.0+ + true + + This element specifies a directory containing the unit test source of the + project. The generated build system will compile these directories when the project is + being tested. The path given is relative to the project descriptor. + The default value is {@code src/test/java}. + + String + + + outputDirectory + 4.0.0+ + + The directory where compiled application classes are placed. + The default value is {@code target/classes}. + + String + + + testOutputDirectory + 4.0.0+ + + The directory where compiled test classes are placed. + The default value is {@code target/test-classes}. + + String + + + extensions + 4.0.0+ + A set of build extensions to use from this project. + + Extension + * + + + + + + 4.0.0+ + + + + + + + + CiManagement + 4.0.0+ + + } element contains information required to the + continuous integration system of the project. + ]]> + + + + system + 4.0.0+ + + The name of the continuous integration system, e.g. {@code continuum}. + + String + + + url + 4.0.0+ + + URL for the continuous integration system used by the project if it has a web interface. + + String + + + notifiers + 4.0.0+ + Configuration for notifying developers/users when a build is unsuccessful, + including user information and notification mode. + + * + Notifier + + + + + + Notifier + Configures one method for notifying users/developers when a build breaks. + 4.0.0+ + + + type + 4.0.0+ + mail + String + The mechanism used to deliver notifications. + + + sendOnError + 4.0.0+ + true + boolean + Whether to send notifications on error. + + + sendOnFailure + 4.0.0+ + true + boolean + Whether to send notifications on failure. + + + sendOnSuccess + 4.0.0+ + true + boolean + Whether to send notifications on success. + + + sendOnWarning + 4.0.0+ + true + boolean + Whether to send notifications on warning. + + + + address + 4.0.0+ + String + + @deprecated Where to send the notification to - eg email address. + + + + configuration + Extended configuration specific to this notifier goes here. + Properties + + String + * + + + + + + Contributor + Description of a person who has contributed to the project, but who does not have + commit privileges. Usually, these contributions come in the form of patches submitted. + 3.0.0+ + + + name + 3.0.0+ + The full name of the contributor. + String + + + email + 3.0.0+ + The email address of the contributor. + String + + + url + 3.0.0+ + The URL for the homepage of the contributor. + String + + + + organization + organisation + 3.0.0+ + The organization to which the contributor belongs. + String + + + organizationUrl + organisationUrl + 3.0.0+ + The URL of the organization. + String + + + roles + 3.0.0+ + + The roles the contributor plays in the project. Each role is described by a + {@code role} element, the body of which is a role name. This can also be used to + describe the contribution. + + + String + * + + + + timezone + 3.0.0+ + + -12 to +14 + or a valid time zone id like "America/Montreal" (UTC-05:00) or "Europe/Paris" (UTC+01:00). + ]]> + + String + + + properties + 3.0.0+ + Properties about the contributor, such as an instant messenger handle. + Properties + + String + * + + + + + + 4.0.0+ + + + + + + + + Dependency + 3.0.0+ + + } element contains information about a dependency + of the project. + ]]> + + + + groupId + 3.0.0+ + true + + + + String + + + artifactId + 3.0.0+ + true + + The unique id for an artifact produced by the project group, e.g. + {@code maven-artifact}. + + String + + + version + 3.0.0+ + + The version of the dependency, e.g. {@code 3.2.1}. Since Maven 2, this can also be + specified as a range of versions. + + String + + + type + 4.0.0+ + + default + artifact handlers for a list. New types can be defined by extensions, so this is not a complete list. + ]]> + + String + jar + + + classifier + 4.0.0+ + + +
  • referring to attached artifact, for example {@code sources} and {@code javadoc}: + see default artifact handlers for a list,
  • +
  • distinguishing two artifacts + that belong to the same POM but were built differently. + For example, {@code jdk14} and {@code jdk15}.
  • + + ]]> +
    + String + false +
    + + scope + 4.0.0+ + + the + dependency mechanism. The default scope is {@code compile}. + ]]> + + String + + + + + systemPath + 4.0.0+ + + discouraged + and may be replaced in later versions. This specifies the path on the filesystem + for this dependency. + Requires an absolute path for the value, not relative. + Use a property that gives the machine specific absolute path, + e.g. {@code ${java.home}}. + ]]> + + String + + + exclusions + 4.0.0+ + Lists a set of artifacts that should be excluded from this dependency's + artifact list when it comes to calculating transitive dependencies. + + Exclusion + * + + + + optional + 4.0.0+ + + Indicates the dependency is optional for use of this library. While the + version of the dependency will be taken into account for dependency calculation if the + library is used elsewhere, it will not be passed on transitively. Note: While the type + of this field is {@code String} for technical reasons, the semantic type is actually + {@code Boolean}. Default value is {@code false}. + + String + +
    + + + 4.0.0+ + + + + + + 4.0.0/4.0.99 + + + + + + 4.0.0+ + + + + + + 4.0.0+ + + + + + + 4.0.0/4.0.99 + + public void clearManagementKey() { + managementKey = null; + } + + + + +
    + + Contributor + Developer + Information about one of the committers on this project. + 3.0.0+ + + + id + 3.0.0+ + The unique ID of the developer in the SCM. + String + + + + + 4.0.0+ + + + + + + + + Exclusion + 4.0.0+ + + } element contains information required to exclude + an artifact to the project. +

    + The {@code groupId} and {@code artifactId} fields are interpreted as glob patterns. + + @see java.nio.file.FileSystem#getPathMatcher + ]]> + + + + groupId + 4.0.0+ + The group ID of the project to exclude. + String + true + + + artifactId + 4.0.0+ + The artifact ID of the project to exclude. + String + true + + + + + IssueManagement + Information about the issue tracking (or bug tracking) system used to manage this + project. + 4.0.0+ + + + system + 4.0.0+ + The name of the issue management system, e.g. Bugzilla + String + + + url + 4.0.0+ + URL for the issue management system used by the project. + String + + + + + 4.0.0+ + + + + + + + + DistributionManagement + 4.0.0+ + This elements describes all that pertains to distribution for a project. It is + primarily used for deployment of artifacts and the site produced by the build. + + + repository + 4.0.0+ + Information needed to deploy the artifacts generated by the project to a + remote repository. + + DeploymentRepository + + + + snapshotRepository + 4.0.0+ + + Where to deploy snapshots of artifacts to. If not given, it defaults to the + {@code repository} element. + + + DeploymentRepository + + + + site + Information needed for deploying the web site of the project. + 4.0.0+ + + Site + + + + downloadUrl + 4.0.0+ + + The URL of the project's download page. If not given users will be + referred to the homepage given by {@code url}. + This is given to assist in locating artifacts that are not in the repository due to + licensing restrictions. + + String + + + relocation + 4.0.0+ + + Relocation information of the artifact if it has been moved to a new group ID + and/or artifact ID. + + + Relocation + + + + status + 4.0.0+ + + Gives the status of this artifact in the remote repository. + This must not be set in your local project, as it is updated by + tools placing it in the repository. Valid values are: {@code none} (default), + {@code converted} (repository manager converted this from an Maven 1 POM), + {@code partner} + (directly synced from a partner Maven 2 repository), {@code deployed} (was deployed from a Maven 2 + instance), {@code verified} (has been hand verified as correct and final). + + false + String + + + + + License + Describes the licenses for this project. This is used to generate the license + page of the project's website, as well as being taken into consideration in other reporting + and validation. The licenses listed for the project are that of the project itself, and not + of dependencies. + 3.0.0+ + + + name + 3.0.0+ + The full legal name of the license. + String + + + url + 3.0.0+ + The official url for the license text. + String + + + distribution + 3.0.0+ + + +

    repo
    +
    may be downloaded from the Maven repository
    +
    manual
    +
    user must manually download and install the dependency.
    + + ]]> +
    + String + + + comments + Addendum information pertaining to this license. + 3.0.0+ + String + + + + + 4.0.0+ + + + + + +
    + + MailingList + 3.0.0+ + This element describes all of the mailing lists associated with a project. The + auto-generated site references this information. + + + name + 3.0.0+ + + The name of the mailing list. + + String + + + subscribe + 3.0.0+ + + The email address or link that can be used to subscribe to + the mailing list. If this is an email address, a + {@code mailto:} link will automatically be created + when the documentation is created. + + String + + + unsubscribe + 3.0.0+ + + The email address or link that can be used to unsubscribe to + the mailing list. If this is an email address, a + {@code mailto:} link will automatically be created + when the documentation is created. + + String + + + post + 3.0.0+ + + The email address or link that can be used to post to + the mailing list. If this is an email address, a + {@code mailto:} link will automatically be created + when the documentation is created. + + String + + + archive + 3.0.0+ + The link to a URL where you can browse the mailing list archive. + String + + + otherArchives + 3.0.0+ + The link to alternate URLs where you can browse the list archive. + + String + * + + + + We could probably have a specific element for a dev mailing list for things like CI, + and maybe even a specific element for the user and scm mailing lists. Then leave the more + lose structure for any other type of mailing list. + + + 4.0.0+ + + + + + + + + Organization + Specifies the organization that produces this project. + 3.0.0+ + + + name + 3.0.0+ + The full name of the organization. + String + + + url + 3.0.0+ + The URL to the organization's home page. + String + + + + + 4.0.0+ + + + + + + + + PatternSet + 3.0.0+ + Definition of include or exclude patterns. + + + includes + 3.0.0+ + + A list of patterns to include, e.g. {@code **&#47;*.xml}. + + + String + * + + + + excludes + 3.0.0+ + + A list of patterns to exclude, e.g. {@code **&#47;*.xml} + + + String + * + + + + + + 4.0.0+ + + + + + + + + Parent + 4.0.0+ + + } element contains information required to locate the parent project from which + this project will inherit from. +

    Note: The children of this element are not interpolated and must be given as literal values.

    + ]]> +
    + + + groupId + 4.0.0+ + The group id of the parent project to inherit from. + true + String + + + artifactId + 4.0.0+ + The artifact id of the parent project to inherit from. + true + String + + + version + 4.0.0+ + The version of the parent project to inherit. + String + + + relativePath + 4.0.0+ + + The relative path of the parent subproject POM file or directory within the checkout. + If not specified, it defaults to {@code ..}, i.e. the parent directory. + Maven looks for the parent POM first in this location on + the filesystem if explicitly provided, then in the reactor if groupId and artifactId are provided, + then in the default parent directory, then the local repository, and lastly in the remote repo. + However, if the both relative path and the group ID / artifact ID are provided, + they must match the file in the location given. + Specify either the {@code relativePath} or the {@code groupId}/{@code artifactId}, not both. + + String + + + + + 4.0.0+ + + + + + + +
    + + Scm + 4.0.0+ + + The {@code <scm>} element contains information required to the SCM + (Source Control Management) of the project. + + + + connection + 4.0.0+ + + Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + scm's {@code child.scm.connection.inherit.append.path="false"} + @see URL format + @see list of supported SCMs + ]]> + + String + + + developerConnection + 4.0.0+ + + Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + scm's {@code child.scm.developerConnection.inherit.append.path="false"}.

    + ]]> +
    + String +
    + + tag + 4.0.0+ + The tag of current code. By default, it's set to HEAD during development. + String + HEAD + + + url + 4.0.0+ + + Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + scm's {@code child.scm.url.inherit.append.path="false"}

    + ]]> +
    + String +
    + + childScmConnectionInheritAppendPath + 4.0.0+ + + Default value is: {@code true}

    + @since Maven 3.6.1 + ]]> +
    + String +
    + + childScmDeveloperConnectionInheritAppendPath + 4.0.0+ + + Default value is: {@code true}

    + @since Maven 3.6.1 + ]]> +
    + String +
    + + childScmUrlInheritAppendPath + 4.0.0+ + + Default value is: {@code true} + @since Maven 3.6.1 + ]]> + + String + +
    + + + 4.0.0+ + + + + + + 4.0.0+ + + + + + +
    + + FileSet + 3.0.0+ + PatternSet + A PatternSet for files. + + + directory + 3.0.0+ + Describe the directory where the resources are stored. The path is relative + to the POM. + String + + + + + 4.0.0+ + + + + + + + + Resource + This element describes all of the classpath resources associated with a project + or unit tests. + 3.0.0+ + FileSet + + + targetPath + 3.0.0+ + + Describe the resource target path. The path is relative to the target/classes + directory (i.e. {@code ${project.build.outputDirectory}}). + For example, if you want that resource to appear in a specific package + ({@code org.apache.maven.messages}), you must specify this + element with this value: {@code org/apache/maven/messages}. + This is not required if you simply put the resources in that directory + structure at the source, however. + + String + + + filtering + 3.0.0+ + + Whether resources are filtered to replace tokens with parameterised values or not. + The values are taken from the {@code properties} element and from the + properties in the files listed in the {@code filters} element. Note: While the type + of this field is {@code String} for technical reasons, the semantic type is actually + {@code Boolean}. Default value is {@code false}. + + String + + + mergeId + 4.0.0+ + + FOR INTERNAL USE ONLY. This is a unique identifier assigned to each + resource to allow Maven to merge changes to this resource that take + place during the execution of a plugin. This field must be managed + by the generated parser and formatter classes in order to allow it + to survive model interpolation. + + String + + + + + 4.0.0+ + + + + + + 4.0.0/4.0.99 + + + + + + 4.0.0+ + + + + + + + + RepositoryBase + 4.0.0+ + A repository contains the information needed for establishing connections with + remote repository. + + + id + 4.0.0+ + true + true + + A unique identifier for a repository. This is used to match the repository + to configuration in the {@code settings.xml} file, for example. Furthermore, the identifier is + used during POM inheritance and profile injection to detect repositories that should be merged. + + String + + + name + 4.0.0+ + Human readable name of the repository. + String + + + url + 4.0.0+ + true + + The url of the repository, in the form {@code protocol://hostname/path}. + + String + + + layout + 4.0.0+ + + The type of layout this repository uses for locating and storing artifacts - + can be {@code legacy} or {@code default}. + + String + default + + + + + + Repository + RepositoryBase + 4.0.0+ + A repository contains the information needed for establishing connections with + remote repository. + + + releases + 4.0.0+ + How to handle downloading of releases from this repository. + + RepositoryPolicy + + + + snapshots + 4.0.0+ + How to handle downloading of snapshots from this repository. + + RepositoryPolicy + + + + + + + DeploymentRepository + Repository + 4.0.0+ + Deployment repository contains the information needed for deploying to the remote + repository, which adds uniqueVersion property to usual repositories for download. + + + uniqueVersion + Whether to assign snapshots a unique version comprised of the timestamp and + build number, or to use the same version each time + boolean + true + 4.0.0+ + + + + + + RepositoryPolicy + 4.0.0+ + Download policy. + + + enabled + 4.0.0+ + + Whether to use this repository for downloading this type of artifact. Note: While the type + of this field is {@code String} for technical reasons, the semantic type is actually + {@code Boolean}. Default value is {@code true}. + + String + + + updatePolicy + 4.0.0+ + + The frequency for downloading updates - can be + {@code always}, + {@code daily} (default), + {@code interval:XXX} (in minutes) or + {@code never} (only if it doesn't exist locally). + + String + + + checksumPolicy + 4.0.0+ + + What to do when verification of an artifact checksum fails. Valid values are + {@code ignore}, + {@code fail} (default for Maven 4 and above) or + {@code warn} (default for Maven 2 and 3). + + String + + + + + 4.0.0+ + + + + + + 4.0.0/4.0.99 + + + + + + + + + + Site + 4.0.0+ + Contains the information needed for deploying websites. + + + id + 4.0.0+ + + A unique identifier for a deployment location. This is used to match the + site to configuration in the {@code settings.xml} file, for example. + + String + + + name + 4.0.0+ + Human readable name of the deployment location. + String + + + url + 4.0.0+ + + Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + site's {@code child.site.url.inherit.append.path="false"}.

    + ]]> +
    + String +
    + + childSiteUrlInheritAppendPath + 4.0.0+ + + Default value is: {@code true}

    + @since Maven 3.6.1 + ]]> +
    + String +
    +
    + + + 4.0.0+ + + + + + +
    + + + ConfigurationContainer + 4.0.0+ + Contains the configuration information of the container like Plugin. + + + inherited + 4.0.0+ + + Whether any configuration should be propagated to child POMs. Note: While the type + of this field is {@code String} for technical reasons, the semantic type is actually + {@code Boolean}. Default value is {@code true}. + + String + + + + The configuration as DOM object.

    +

    By default, every element content is trimmed, but starting with Maven 3.1.0, you can add + {@code xml:space="preserve"} to elements you want to preserve whitespace.

    +

    You can control how child POMs inherit configuration from parent POMs by adding {@code combine.children} + or {@code combine.self} attributes to the children of the configuration element:

    +
      +
    • {@code combine.children}: available values are {@code merge} (default) and {@code append},
    • +
    • {@code combine.self}: available values are {@code merge} (default) and {@code override}.
    • +
    + + @see POM Reference documentation + @see Xpp3DomUtils + ]]> +
    + configuration + DOM +
    +
    + + + 4.0.0+ + + + + + + 4.0.0/4.0.99 + + + + + +
    + + Plugin + 4.0.0+ + ConfigurationContainer + + The {@code <plugin>} element contains information required for a plugin. + + + + groupId + The group ID of the plugin in the repository. + 4.0.0+ + String + org.apache.maven.plugins + + + artifactId + The artifact ID of the plugin in the repository. + 4.0.0+ + String + true + + + version + 4.0.0+ + The version (or valid range of versions) of the plugin to be used. + String + + + extensions + 4.0.0+ + String + + Whether to load Maven extensions (such as packaging and type handlers) from + this plugin. For performance reasons, this should only be enabled when necessary. Note: While the type + of this field is {@code String} for technical reasons, the semantic type is actually + {@code Boolean}. Default value is {@code false}. + + + + executions + 4.0.0+ + Multiple specifications of a set of goals to execute during the build + lifecycle, each having (possibly) a different configuration. + + PluginExecution + * + + + + goals + 4.0.0 + + @deprecated Unused by Maven. + + DOM + + + dependencies + Additional dependencies that this project needs to introduce to the plugin's + classloader. + 4.0.0+ + + Dependency + * + + + + + + 4.0.0+ + + + + + + 4.0.0/4.0.99 + + getExecutionsAsMap() { + return getExecutions().stream().collect(Collectors.toMap(exec -> exec.getId(), exec -> exec)); + } + ]]> + + + + 4.0.0+ + + ::}, never {@code null} + */ + public String getId() { + return new StringBuilder(128) + .append((getGroupId() == null) ? "[unknown-group-id]" : getGroupId()) + .append(":") + .append((getArtifactId() == null) ? "[unknown-artifact-id]" : getArtifactId()) + .append(":") + .append((getVersion() == null) ? "[unknown-version]" : getVersion()) + .toString(); + } + + /** + * @return the key of the plugin, ie {@code groupId:artifactId} + */ + public String getKey() { + return constructKey(getGroupId(), getArtifactId()); + } + + /** + * @param groupId the group ID of the plugin in the repository + * @param artifactId the artifact ID of the reporting plugin in the repository + * @return the key of the plugin, ie {@code groupId:artifactId} + */ + public static String constructKey(String groupId, String artifactId) { + return groupId + ":" + artifactId; + } + + ]]> + + + + 4.1.0+ + + + + + + + + PluginExecution + 4.0.0+ + ConfigurationContainer + + The {@code @lt;execution>} element contains information required for the + execution of a plugin. + + + + id + 4.0.0+ + String + default + The identifier of this execution for labelling the goals during the build, + and for matching executions to merge during inheritance and profile injection. + + + phase + 4.0.0+ + String + The build lifecycle phase to bind the goals in this execution to. If omitted, + the goals will be bound to the default phase specified by the plugin. + + + priority + 4.0.0+ + int + + Warning: This is an internal utility property that is only public for technical reasons, + it is not part of the public API. In particular, this property can be changed or deleted without prior + notice.

    + ]]> +
    +
    + + goals + 4.0.0+ + The goals to execute with the given configuration. + + String + * + + +
    + + + 4.0.0+ + + + + + +
    + + DependencyManagement + 4.0.0+ + Section for management of default dependency information for use in a group of + POMs. + + + dependencies + 4.0.0+ + The dependencies specified here are not used until they are referenced in a + POM within the group. This allows the specification of a "standard" version for a + particular dependency. + + Dependency + * + + + + + + PluginManagement + 4.0.0+ + PluginContainer + Section for management of default plugin information for use in a group of POMs. + + + + Reporting + 4.0.0+ + Section for management of reports and their configuration. + + + excludeDefaults + 4.0.0+ + String + + If true, then the default reports are not included in the site generation. + This includes the reports in the "Project Info" menu. Note: While the type + of this field is {@code String} for technical reasons, the semantic type is actually + {@code Boolean}. Default value is {@code false}. + + + + outputDirectory + 4.0.0+ + String + + Where to store all the generated reports. The default is + {@code ${project.build.directory}/site}. + + + + + plugins + 4.0.0+ + The reporting plugins to use and their configuration. + + ReportPlugin + * + + + + + + 4.0.0+ + + + + + + 4.0.0/4.0.99 + + reportPluginMap field to null + */ + @Deprecated + public void flushReportPluginMap() { + } + + /** + * @return a Map of plugins field with ReportPlugin#getKey() as key + * @see org.apache.maven.model.ReportPlugin#getKey() + */ + public java.util.Map getReportPluginsAsMap() { + return getPlugins().stream().collect(Collectors.toMap(report -> report.getKey(), report -> report)); + } + ]]> + + + + + + + Profile + ModelBase + 4.0.0+ + Modifications to the build process which is activated based on environmental + parameters or command line arguments. + + + id + true + 4.0.0+ + String + default + The identifier of this build profile. This is used for command line + activation, and identifies profiles to be merged. + + + + activation + 4.0.0+ + The conditional logic which will automatically trigger the inclusion of this + profile. + + Activation + + + + build + 4.0.0+ + true + Information required to build the project. + + BuildBase + + + + + + 4.0.0/4.0.99 + + + + + + 4.1.0+ + + + + + + + + Activation + 4.0.0+ + In addition to the traditional activation mechanisms (JDK version, OS properties, + file existence, etc.), Maven now supports a powerful condition-based activation + through the {@code condition} field. This new mechanism allows for more flexible + and expressive profile activation rules.

    + +

    Condition Syntax

    + +

    The condition is specified as a string expression that can include various + functions, comparisons, and logical operators. Some key features include:

    + +
      +
    • Property access: {@code ${property.name}}
    • +
    • Comparison operators: {@code ==}, {@code !=}, {@code <}, {@code >}, {@code <=}, {@code >=}
    • +
    • Logical operators: {@code &&} (AND), {@code ||} (OR), {@code not(...)}
    • +
    • Functions: {@code exists(...)}, {@code missing(...)}, {@code matches(...)}, {@code inrange(...)}, and more
    • +
    + +

    Supported Functions

    + +

    The following functions are supported in condition expressions:

    + +
      +
    • {@code length(string)}: Returns the length of the given string.
    • +
    • {@code upper(string)}: Converts the string to uppercase.
    • +
    • {@code lower(string)}: Converts the string to lowercase.
    • +
    • {@code substring(string, start, [end])}: Returns a substring of the given string.
    • +
    • {@code indexOf(string, substring)}: Returns the index of the first occurrence of substring in string, or -1 if not found.
    • +
    • {@code contains(string, substring)}: Checks if the string contains the substring.
    • +
    • {@code matches(string, regex)}: Checks if the string matches the given regular expression.
    • +
    • {@code not(condition)}: Negates the given condition.
    • +
    • {@code if(condition, trueValue, falseValue)}: Returns trueValue if the condition is true, falseValue otherwise.
    • +
    • {@code exists(path)}: Checks if a file matching the given glob pattern exists.
    • +
    • {@code missing(path)}: Checks if a file matching the given glob pattern does not exist.
    • +
    • {@code inrange(version, range)}: Checks if the given version is within the specified version range.
    • +
    + +

    Supported properties

    + +

    The following properties are supported in expressions:

    + +
      +
    • `project.basedir`: The project directory
    • +
    • `project.rootDirectory`: The root directory of the project
    • +
    • `project.artifactId`: The artifactId of the project
    • +
    • `project.packaging`: The packaging of the project
    • +
    • user properties
    • +
    • system properties (including environment variables prefixed with `env.`)
    • +
    + +

    Examples

    + +
      +
    • JDK version range: {@code inrange(${java.version}, '[11,)')} (JDK 11 or higher)
    • +
    • OS check: {@code ${os.name} == 'windows'}
    • +
    • File existence: {@code exists('${project.basedir}/src/**}{@code /*.xsd')}
    • +
    • Property check: {@code ${my.property} != 'some-value'}
    • +
    • Regex matching: {@code matches(${os.version}, '.*aws')}
    • +
    • Complex condition: {@code ${os.name} == 'windows' && ${os.arch} != 'amd64' && inrange(${os.version}, '[10,)')}
    • +
    • String length check: {@code length(${user.name}) > 5}
    • +
    • Substring with version: {@code substring(${java.version}, 0, 3) == '1.8'}
    • +
    • Using indexOf: {@code indexOf(${java.version}, '-') > 0}
    • +
    • Conditional logic: {@code if(contains(${java.version}, '-'), substring(${java.version}, 0, indexOf(${java.version}, '-')), ${java.version})}
    • +
    + +

    This flexible condition mechanism allows for more precise control over profile + activation, enabling developers to create profiles that respond to a wide range of + environmental factors and project states.

    + ]]>
    + + + activeByDefault + 4.0.0+ + boolean + If set to true, this profile will be active unless another profile in this + pom is activated using the command line -P option or by one of that profile's + activators. + + + jdk + 4.0.0+ + String + + Specifies that this profile will be activated when a matching JDK is detected. + For example, {@code 1.4} only activates on JDKs versioned 1.4, + while {@code !1.4} matches any JDK that is not version 1.4. Ranges are supported too: + {@code [1.5,)} activates when the JDK is 1.5 minimum. + + + + os + 4.0.0+ + Specifies that this profile will be activated when matching operating system + attributes are detected. + + ActivationOS + + + + property + 4.0.0+ + Specifies that this profile will be activated when this property is + specified. + + ActivationProperty + + + + file + 4.0.0+ + Specifies that this profile will be activated based on existence of a file. + + ActivationFile + + + + packaging + 4.1.0+ + String + Specifies that this profile will be activated based on the project's packaging. + + + condition + 4.1.0+ + String + The condition which must be satisfied to activate the profile. + + + +
    + + ActivationProperty + 4.0.0+ + This is the property specification used to activate a profile. If the value field + is empty, then the existence of the named property will activate the profile, otherwise it + does a case-sensitive match against the property value as well. + + + name + 4.0.0+ + String + true + The name of the property to be used to activate a profile. + + + value + 4.0.0+ + String + The value of the property required to activate a profile. + + + + + ActivationOS + 4.0.0+ + This is an activator which will detect an operating system's attributes in order + to activate its profile. + + + name + 4.0.0+ + String + + The name of the operating system to be used to activate the profile. This must be an exact match + of the {@code ${os.name}} Java property, such as {@code Windows XP}. + + + + family + 4.0.0+ + String + + The general family of the OS to be used to activate the profile, such as + {@code windows} or {@code unix}. + + + + arch + 4.0.0+ + String + The architecture of the operating system to be used to activate the + profile. + + + version + 4.0.0+ + String + The version of the operating system to be used to activate the + profile. + + + + + ActivationFile + 4.0.0+ + This is the file specification used to activate the profile. The {@code missing} value + is the location of a file that needs to exist, and if it doesn't, the profile will be + activated. On the other hand, {@code exists} will test for the existence of the file and if it is + there, the profile will be activated. + <p>Variable interpolation for these file specifications is limited to {@code ${project.basedir}}, + system properties and user properties.</p> + + + missing + 4.0.0+ + String + The name of the file that must be missing to activate the profile. Please note, that missing and exists + fields cannot be used together. Only one of them should be used at any one time. + + + exists + 4.0.0+ + String + The name of the file that must exist to activate the profile. Please note, that missing and exists + fields cannot be used together. Only one of them should be used at any one time. + + + + + + + ReportPlugin + 4.0.0+ + ConfigurationContainer + + } element in {@code } contains information required for a report plugin. + ]]> + + + + groupId + 4.0.0+ + String + true + org.apache.maven.plugins + The group ID of the reporting plugin in the repository. + + + artifactId + 4.0.0+ + String + true + The artifact ID of the reporting plugin in the repository. + + + version + 4.0.0+ + + The version of the reporting plugin to be used. Starting with Maven 3, if no version is defined explicitly, + version is searched in {@code build/plugins} then in {@code build/pluginManagement}. + + String + + + reportSets + 4.0.0+ + + Multiple specifications of a set of reports, each having (possibly) different + configuration. This is the reporting parallel to an {@code execution} in the build. + + + ReportSet + * + + + + + + 4.0.0+ + + reportSetMap = null; + + /** + * Reset the {@code reportSetMap} field to {@code null} + */ + public void flushReportSetMap() { + this.reportSetMap = null; + } + + /** + * @return a Map of reportSets field with {@code ReportSet#getId()} as key + * @see ReportSet#getId() + */ + public java.util.Map getReportSetsAsMap() { + if (reportSetMap == null) { + reportSetMap = new java.util.LinkedHashMap(); + if (getReportSets() != null) { + for (java.util.Iterator i = getReportSets().iterator(); i.hasNext(); ) { + ReportSet reportSet = (ReportSet) i.next(); + reportSetMap.put(reportSet.getId(), reportSet); + } + } + } + + return reportSetMap; + } + + /** + * @return the key of the report plugin, ie {@code groupId:artifactId} + */ + public String getKey() { + return constructKey(getGroupId(), getArtifactId()); + } + + /** + * @param groupId The group ID of the plugin in the repository + * @param artifactId The artifact ID of the reporting plugin in the repository + * @return the key of the report plugin, ie {@code groupId:artifactId} + */ + public static String constructKey(String groupId, String artifactId) { + return groupId + ":" + artifactId; + } + ]]> + + + + + + ReportSet + 4.0.0+ + ConfigurationContainer + Represents a set of reports and configuration to be used to generate them. + + + id + String + true + The unique id for this report set, to be used during POM inheritance and profile injection + for merging of report sets. + + default + + + reports + 4.0.0+ + true + The list of reports from this plugin which should be generated from this set. + + String + * + + + + + + 4.0.0+ + + + + + + + + Prerequisites + 4.0.0+ + Describes the prerequisites a project can have. + + + maven + 4.0.0+ + String + 2.0 + + In Maven 2, this was also specifying the minimum version of Maven required to build a + project, but this usage is deprecated in Maven 3 and not checked any more: use + the Maven Enforcer Plugin's + {@code requireMavenVersion} rule instead. + ]]> + + false + + + + + Relocation + 4.0.0+ + Describes where an artifact has moved to. If any of the values are omitted, it is + assumed to be the same as it was before. + + + groupId + 4.0.0+ + The group ID the artifact has moved to. + String + + + artifactId + 4.0.0+ + The new artifact ID of the artifact. + String + + + version + 4.0.0+ + The new version of the artifact. + String + + + message + 4.0.0+ + An additional message to show the user about the move, such as the reason. + String + + + + + Extension + 4.0.0+ + Describes a build extension to utilise. + + + groupId + 4.0.0+ + The group ID of the extension's artifact. + true + String + + + artifactId + 4.0.0+ + The artifact ID of the extension. + true + String + + + version + 4.0.0+ + The version of the extension. + String + + + configuration + 4.1.0+ + + The configuration of the extension. + @since Maven 4.0.0 + + DOM + + + + + 4.1.0+ + + + + + + + + InputLocation + 4.0.0/4.0.99 + + + + + + 4.0.0+ + + + + + + + + InputSource + 4.0.0/4.0.99 + + + modelId + 4.0.0+ + String + + The identifier of the POM in the format {@code <groupId>:<artifactId>:<version>}. + + + + location + 4.0.0+ + String + + The path/URL of the POM or {@code null} if unknown. + + + + + + 4.0.0+ + + + + + + +
    +