You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2024/04/11 14:06:40 UTC
(maven) branch master updated: [MNG-8084] Include repository metadata in the API (#1465)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new 84e2d8ad3f [MNG-8084] Include repository metadata in the API (#1465)
84e2d8ad3f is described below
commit 84e2d8ad3f2c7f96aaadf5475f272842bfeec88a
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Apr 11 16:06:34 2024 +0200
[MNG-8084] Include repository metadata in the API (#1465)
---
.../maven-api-metadata}/pom.xml | 64 +++++++++-------------
.../apache/maven/api/metadata/package-info.java | 5 ++
.../maven-api-metadata}/src/main/mdo/metadata.mdo | 0
api/maven-api-metadata/src/site/apt/index.apt | 33 +++++++++++
api/maven-api-metadata/src/site/site.xml | 38 +++++++++++++
api/pom.xml | 1 +
maven-repository-metadata/pom.xml | 13 +++--
.../artifact/repository/metadata/MetadataTest.java | 2 +-
pom.xml | 5 ++
9 files changed, 117 insertions(+), 44 deletions(-)
diff --git a/maven-repository-metadata/pom.xml b/api/maven-api-metadata/pom.xml
similarity index 59%
copy from maven-repository-metadata/pom.xml
copy to api/maven-api-metadata/pom.xml
index 38c62f62bd..1488f69222 100644
--- a/maven-repository-metadata/pom.xml
+++ b/api/maven-api-metadata/pom.xml
@@ -17,35 +17,24 @@ 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+<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</artifactId>
+ <artifactId>maven-api</artifactId>
<version>4.0.0-alpha-14-SNAPSHOT</version>
</parent>
- <artifactId>maven-repository-metadata</artifactId>
+ <artifactId>maven-api-metadata</artifactId>
- <name>Maven Repository Metadata Model</name>
- <description>Per-directory local and remote repository metadata.</description>
+ <name>Maven 4 API :: Repository Metadata</name>
+ <description>Maven 4 API - Immutable Repository Metadata model.</description>
<dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-xml</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-xml-impl</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-api</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -53,54 +42,53 @@ under the License.
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
- <configuration>
- <version>1.2.0</version>
- <models>
- <model>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>packageToolV4=org.apache.maven.artifact.repository.metadata.io</param>
- </params>
- <velocityBasedir>${project.basedir}/../src/mdo</velocityBasedir>
- </configuration>
<executions>
<execution>
- <id>modello</id>
+ <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>
- <template>reader-stax.vm</template>
- <template>writer-stax.vm</template>
</templates>
+ <params>
+ <param>packageModelV4=org.apache.maven.api.metadata</param>
+ </params>
</configuration>
</execution>
<execution>
- <id>modello-v3</id>
+ <id>plugin-doc</id>
<goals>
- <goal>velocity</goal>
+ <goal>xdoc</goal>
+ <goal>xsd</goal>
</goals>
+ <phase>generate-resources</phase>
<configuration>
- <version>1.1.0</version>
+ <version>1.2.0</version>
<models>
<model>src/main/mdo/metadata.mdo</model>
</models>
- <templates>
- <template>model-v3.vm</template>
- </templates>
</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>
diff --git a/api/maven-api-metadata/src/main/java/org/apache/maven/api/metadata/package-info.java b/api/maven-api-metadata/src/main/java/org/apache/maven/api/metadata/package-info.java
new file mode 100644
index 0000000000..68e28d951c
--- /dev/null
+++ b/api/maven-api-metadata/src/main/java/org/apache/maven/api/metadata/package-info.java
@@ -0,0 +1,5 @@
+// CHECKSTYLE_OFF: RegexpHeader
+/**
+ * Maven Repository Metadata model.
+ */
+package org.apache.maven.api.metadata;
diff --git a/maven-repository-metadata/src/main/mdo/metadata.mdo b/api/maven-api-metadata/src/main/mdo/metadata.mdo
similarity index 100%
rename from maven-repository-metadata/src/main/mdo/metadata.mdo
rename to api/maven-api-metadata/src/main/mdo/metadata.mdo
diff --git a/api/maven-api-metadata/src/site/apt/index.apt b/api/maven-api-metadata/src/site/apt/index.apt
new file mode 100644
index 0000000000..a3f76ef0a6
--- /dev/null
+++ b/api/maven-api-metadata/src/site/apt/index.apt
@@ -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.
+
diff --git a/api/maven-api-metadata/src/site/site.xml b/api/maven-api-metadata/src/site/site.xml
new file mode 100644
index 0000000000..8ffe43d07c
--- /dev/null
+++ b/api/maven-api-metadata/src/site/site.xml
@@ -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>
\ No newline at end of file
diff --git a/api/pom.xml b/api/pom.xml
index 86a89a19af..5af8c98865 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -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>
diff --git a/maven-repository-metadata/pom.xml b/maven-repository-metadata/pom.xml
index 38c62f62bd..5a5c785bcc 100644
--- a/maven-repository-metadata/pom.xml
+++ b/maven-repository-metadata/pom.xml
@@ -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>
diff --git a/maven-repository-metadata/src/test/java/org/apache/maven/artifact/repository/metadata/MetadataTest.java b/maven-repository-metadata/src/test/java/org/apache/maven/artifact/repository/metadata/MetadataTest.java
index b2d6d7842b..b5ed73132f 100644
--- a/maven-repository-metadata/src/test/java/org/apache/maven/artifact/repository/metadata/MetadataTest.java
+++ b/maven-repository-metadata/src/test/java/org/apache/maven/artifact/repository/metadata/MetadataTest.java
@@ -224,7 +224,7 @@ class MetadataTest {
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());
diff --git a/pom.xml b/pom.xml
index a0bb13ea7f..bb8aaf6579 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>