[MNG-8084] Include repository metadata in the API (#1465)

This commit is contained in:
Guillaume Nodet 2024-04-11 16:06:34 +02:00 committed by GitHub
parent 34863e6345
commit 84e2d8ad3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 185 additions and 6 deletions

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api</artifactId>
<version>4.0.0-alpha-14-SNAPSHOT</version>
</parent>
<artifactId>maven-api-metadata</artifactId>
<name>Maven 4 API :: Repository Metadata</name>
<description>Maven 4 API - Immutable Repository Metadata model.</description>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-xml-impl</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<executions>
<execution>
<id>plugin</id>
<goals>
<goal>velocity</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<velocityBasedir>${project.basedir}/../../src/mdo</velocityBasedir>
<version>1.2.0</version>
<models>
<model>src/main/mdo/metadata.mdo</model>
</models>
<templates>
<template>model.vm</template>
</templates>
<params>
<param>packageModelV4=org.apache.maven.api.metadata</param>
</params>
</configuration>
</execution>
<execution>
<id>plugin-doc</id>
<goals>
<goal>xdoc</goal>
<goal>xsd</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<version>1.2.0</version>
<models>
<model>src/main/mdo/metadata.mdo</model>
</models>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/package-info.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,5 @@
// CHECKSTYLE_OFF: RegexpHeader
/**
* Maven Repository Metadata model.
*/
package org.apache.maven.api.metadata;

View File

@ -0,0 +1,33 @@
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
-----
Introduction
-----
Guillaume Nodet
-----
2024-04-04
-----
Maven 4 API - Repository Metadata Model
This is the immutable model for Repository Metadata in <<<org.apache.maven.api.metadata>>> package.
The following are generated from this model:
* {{{./apidocs/index.html}Java sources}} with <<<Builder>>> inner classes for immutable instances creation.

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/DECORATION/1.8.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.0 http://maven.apache.org/xsd/decoration-1.8.0.xsd">
<edit>${project.scm.url}</edit>
<body>
<menu name="Overview">
<item name="Introduction" href="index.html"/>
<item name="Javadocs" href="apidocs/index.html"/>
<item name="Source Xref" href="xref/index.html"/>
<!--item name="FAQ" href="faq.html"/-->
</menu>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>

View File

@ -39,6 +39,7 @@
<module>maven-api-plugin</module>
<module>maven-api-settings</module>
<module>maven-api-toolchain</module>
<module>maven-api-metadata</module>
<module>maven-api-core</module>
<module>maven-api-spi</module>
</modules>

View File

@ -32,6 +32,10 @@ under the License.
<description>Per-directory local and remote repository metadata.</description>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-metadata</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-xml</artifactId>
@ -56,12 +60,12 @@ under the License.
<configuration>
<version>1.2.0</version>
<models>
<model>src/main/mdo/metadata.mdo</model>
<model>../api/maven-api-metadata/src/main/mdo/metadata.mdo</model>
</models>
<params>
<param>forcedIOModelVersion=1.1.0</param>
<param>packageModelV3=org.apache.maven.artifact.repository.metadata</param>
<param>packageModelV4=org.apache.maven.artifact.repository.metadata.v4</param>
<param>packageModelV4=org.apache.maven.api.metadata</param>
<param>packageToolV4=org.apache.maven.artifact.repository.metadata.io</param>
</params>
<velocityBasedir>${project.basedir}/../src/mdo</velocityBasedir>
@ -75,10 +79,9 @@ under the License.
<configuration>
<version>1.2.0</version>
<models>
<model>src/main/mdo/metadata.mdo</model>
<model>../api/maven-api-metadata/src/main/mdo/metadata.mdo</model>
</models>
<templates>
<template>model.vm</template>
<template>reader-stax.vm</template>
<template>writer-stax.vm</template>
</templates>
@ -92,7 +95,7 @@ under the License.
<configuration>
<version>1.1.0</version>
<models>
<model>src/main/mdo/metadata.mdo</model>
<model>../api/maven-api-metadata/src/main/mdo/metadata.mdo</model>
</models>
<templates>
<template>model-v3.vm</template>

View File

@ -224,7 +224,7 @@ void testRoundtrip() throws Exception {
System.setProperty(XMLInputFactory.class.getName(), WstxInputFactory.class.getName());
System.setProperty(XMLOutputFactory.class.getName(), WstxOutputFactory.class.getName());
Metadata source = new Metadata(org.apache.maven.artifact.repository.metadata.v4.Metadata.newBuilder(
Metadata source = new Metadata(org.apache.maven.api.metadata.Metadata.newBuilder(
createMetadataFromArtifact(artifact).getDelegate(), true)
.modelEncoding("UTF-16")
.build());

View File

@ -278,6 +278,11 @@ under the License.
<artifactId>maven-api-di</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-metadata</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-di</artifactId>