Skip to content

Commit 84e2d8a

Browse files
authored
[MNG-8084] Include repository metadata in the API (apache#1465)
1 parent 34863e6 commit 84e2d8a

File tree

9 files changed

+185
-6
lines changed

9 files changed

+185
-6
lines changed

api/maven-api-metadata/pom.xml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<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">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.apache.maven</groupId>
24+
<artifactId>maven-api</artifactId>
25+
<version>4.0.0-alpha-14-SNAPSHOT</version>
26+
</parent>
27+
28+
<artifactId>maven-api-metadata</artifactId>
29+
30+
<name>Maven 4 API :: Repository Metadata</name>
31+
<description>Maven 4 API - Immutable Repository Metadata model.</description>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>org.apache.maven</groupId>
36+
<artifactId>maven-xml-impl</artifactId>
37+
</dependency>
38+
</dependencies>
39+
40+
<build>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.codehaus.modello</groupId>
44+
<artifactId>modello-maven-plugin</artifactId>
45+
<executions>
46+
<execution>
47+
<id>plugin</id>
48+
<goals>
49+
<goal>velocity</goal>
50+
</goals>
51+
<phase>generate-sources</phase>
52+
<configuration>
53+
<velocityBasedir>${project.basedir}/../../src/mdo</velocityBasedir>
54+
<version>1.2.0</version>
55+
<models>
56+
<model>src/main/mdo/metadata.mdo</model>
57+
</models>
58+
<templates>
59+
<template>model.vm</template>
60+
</templates>
61+
<params>
62+
<param>packageModelV4=org.apache.maven.api.metadata</param>
63+
</params>
64+
</configuration>
65+
</execution>
66+
<execution>
67+
<id>plugin-doc</id>
68+
<goals>
69+
<goal>xdoc</goal>
70+
<goal>xsd</goal>
71+
</goals>
72+
<phase>generate-resources</phase>
73+
<configuration>
74+
<version>1.2.0</version>
75+
<models>
76+
<model>src/main/mdo/metadata.mdo</model>
77+
</models>
78+
</configuration>
79+
</execution>
80+
</executions>
81+
</plugin>
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-compiler-plugin</artifactId>
85+
<configuration>
86+
<excludes>
87+
<exclude>**/package-info.java</exclude>
88+
</excludes>
89+
</configuration>
90+
</plugin>
91+
</plugins>
92+
</build>
93+
94+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// CHECKSTYLE_OFF: RegexpHeader
2+
/**
3+
* Maven Repository Metadata model.
4+
*/
5+
package org.apache.maven.api.metadata;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
~~ Licensed to the Apache Software Foundation (ASF) under one
2+
~~ or more contributor license agreements. See the NOTICE file
3+
~~ distributed with this work for additional information
4+
~~ regarding copyright ownership. The ASF licenses this file
5+
~~ to you under the Apache License, Version 2.0 (the
6+
~~ "License"); you may not use this file except in compliance
7+
~~ with the License. You may obtain a copy of the License at
8+
~~
9+
~~ http://www.apache.org/licenses/LICENSE-2.0
10+
~~
11+
~~ Unless required by applicable law or agreed to in writing,
12+
~~ software distributed under the License is distributed on an
13+
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
~~ KIND, either express or implied. See the License for the
15+
~~ specific language governing permissions and limitations
16+
~~ under the License.
17+
18+
-----
19+
Introduction
20+
-----
21+
Guillaume Nodet
22+
-----
23+
2024-04-04
24+
-----
25+
26+
Maven 4 API - Repository Metadata Model
27+
28+
This is the immutable model for Repository Metadata in <<<org.apache.maven.api.metadata>>> package.
29+
30+
The following are generated from this model:
31+
32+
* {{{./apidocs/index.html}Java sources}} with <<<Builder>>> inner classes for immutable instances creation.
33+
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<project xmlns="http://maven.apache.org/DECORATION/1.8.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.0 http://maven.apache.org/xsd/decoration-1.8.0.xsd">
24+
25+
<edit>${project.scm.url}</edit>
26+
27+
<body>
28+
<menu name="Overview">
29+
<item name="Introduction" href="index.html"/>
30+
<item name="Javadocs" href="apidocs/index.html"/>
31+
<item name="Source Xref" href="xref/index.html"/>
32+
<!--item name="FAQ" href="faq.html"/-->
33+
</menu>
34+
35+
<menu ref="parent"/>
36+
<menu ref="reports"/>
37+
</body>
38+
</project>

api/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<module>maven-api-plugin</module>
4040
<module>maven-api-settings</module>
4141
<module>maven-api-toolchain</module>
42+
<module>maven-api-metadata</module>
4243
<module>maven-api-core</module>
4344
<module>maven-api-spi</module>
4445
</modules>

maven-repository-metadata/pom.xml

+8-5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ under the License.
3232
<description>Per-directory local and remote repository metadata.</description>
3333

3434
<dependencies>
35+
<dependency>
36+
<groupId>org.apache.maven</groupId>
37+
<artifactId>maven-api-metadata</artifactId>
38+
</dependency>
3539
<dependency>
3640
<groupId>org.codehaus.plexus</groupId>
3741
<artifactId>plexus-xml</artifactId>
@@ -56,12 +60,12 @@ under the License.
5660
<configuration>
5761
<version>1.2.0</version>
5862
<models>
59-
<model>src/main/mdo/metadata.mdo</model>
63+
<model>../api/maven-api-metadata/src/main/mdo/metadata.mdo</model>
6064
</models>
6165
<params>
6266
<param>forcedIOModelVersion=1.1.0</param>
6367
<param>packageModelV3=org.apache.maven.artifact.repository.metadata</param>
64-
<param>packageModelV4=org.apache.maven.artifact.repository.metadata.v4</param>
68+
<param>packageModelV4=org.apache.maven.api.metadata</param>
6569
<param>packageToolV4=org.apache.maven.artifact.repository.metadata.io</param>
6670
</params>
6771
<velocityBasedir>${project.basedir}/../src/mdo</velocityBasedir>
@@ -75,10 +79,9 @@ under the License.
7579
<configuration>
7680
<version>1.2.0</version>
7781
<models>
78-
<model>src/main/mdo/metadata.mdo</model>
82+
<model>../api/maven-api-metadata/src/main/mdo/metadata.mdo</model>
7983
</models>
8084
<templates>
81-
<template>model.vm</template>
8285
<template>reader-stax.vm</template>
8386
<template>writer-stax.vm</template>
8487
</templates>
@@ -92,7 +95,7 @@ under the License.
9295
<configuration>
9396
<version>1.1.0</version>
9497
<models>
95-
<model>src/main/mdo/metadata.mdo</model>
98+
<model>../api/maven-api-metadata/src/main/mdo/metadata.mdo</model>
9699
</models>
97100
<templates>
98101
<template>model-v3.vm</template>

maven-repository-metadata/src/test/java/org/apache/maven/artifact/repository/metadata/MetadataTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void testRoundtrip() throws Exception {
224224
System.setProperty(XMLInputFactory.class.getName(), WstxInputFactory.class.getName());
225225
System.setProperty(XMLOutputFactory.class.getName(), WstxOutputFactory.class.getName());
226226

227-
Metadata source = new Metadata(org.apache.maven.artifact.repository.metadata.v4.Metadata.newBuilder(
227+
Metadata source = new Metadata(org.apache.maven.api.metadata.Metadata.newBuilder(
228228
createMetadataFromArtifact(artifact).getDelegate(), true)
229229
.modelEncoding("UTF-16")
230230
.build());

pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ under the License.
278278
<artifactId>maven-api-di</artifactId>
279279
<version>${project.version}</version>
280280
</dependency>
281+
<dependency>
282+
<groupId>org.apache.maven</groupId>
283+
<artifactId>maven-api-metadata</artifactId>
284+
<version>${project.version}</version>
285+
</dependency>
281286
<dependency>
282287
<groupId>org.apache.maven</groupId>
283288
<artifactId>maven-di</artifactId>

0 commit comments

Comments
 (0)