Skip to content

Commit 5acb174

Browse files
Migrate Documentation to Antora.
See: #4497
1 parent 492f09f commit 5acb174

File tree

92 files changed

+5849
-5525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+5849
-5525
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ src/ant/.ant-targets-upload-dist.xml
1515
atlassian-ide-plugin.xml
1616
/.gradle/
1717
/.idea/
18-
*.graphml
18+
*.graphml
19+
build/
20+
node_modules
21+
node
22+
package.json
23+
package-lock.json

spring-data-mongodb-distribution/pom.xml

+15-40
Original file line numberDiff line numberDiff line change
@@ -21,60 +21,35 @@
2121

2222
<properties>
2323
<project.root>${basedir}/..</project.root>
24-
<dist.key>SDMONGO</dist.key>
25-
26-
<!-- Observability -->
27-
<micrometer-docs-generator.inputPath>${maven.multiModuleProjectDirectory}/spring-data-mongodb/</micrometer-docs-generator.inputPath>
28-
<micrometer-docs-generator.inclusionPattern>.*</micrometer-docs-generator.inclusionPattern>
29-
<micrometer-docs-generator.outputPath>${maven.multiModuleProjectDirectory}/target/</micrometer-docs-generator.outputPath>
24+
<antora.playbook>${project.basedir}/../src/main/antora/antora-playbook.yml</antora.playbook>
3025
</properties>
3126

3227
<build>
28+
<resources>
29+
<resource>
30+
<directory>${project.basedir}/../src/main/antora/resources/antora-resources</directory>
31+
<filtering>true</filtering>
32+
</resource>
33+
</resources>
3334
<plugins>
3435
<plugin>
3536
<groupId>org.apache.maven.plugins</groupId>
36-
<artifactId>maven-assembly-plugin</artifactId>
37-
</plugin>
38-
<plugin>
39-
<groupId>org.codehaus.mojo</groupId>
40-
<artifactId>exec-maven-plugin</artifactId>
37+
<artifactId>maven-resources-plugin</artifactId>
4138
<executions>
4239
<execution>
43-
<id>generate-docs</id>
44-
<phase>generate-resources</phase>
4540
<goals>
46-
<goal>java</goal>
41+
<goal>resources</goal>
4742
</goals>
48-
<configuration>
49-
<mainClass>io.micrometer.docs.DocsGeneratorCommand</mainClass>
50-
<includePluginDependencies>true</includePluginDependencies>
51-
<arguments>
52-
<argument>${micrometer-docs-generator.inputPath}</argument>
53-
<argument>${micrometer-docs-generator.inclusionPattern}</argument>
54-
<argument>${micrometer-docs-generator.outputPath}</argument>
55-
</arguments>
56-
</configuration>
5743
</execution>
5844
</executions>
59-
<dependencies>
60-
<dependency>
61-
<groupId>io.micrometer</groupId>
62-
<artifactId>micrometer-docs-generator</artifactId>
63-
<version>1.0.1</version>
64-
<type>jar</type>
65-
</dependency>
66-
</dependencies>
6745
</plugin>
6846
<plugin>
69-
<groupId>org.asciidoctor</groupId>
70-
<artifactId>asciidoctor-maven-plugin</artifactId>
71-
<configuration>
72-
<attributes>
73-
<mongo-reactivestreams>${mongo.reactivestreams}
74-
</mongo-reactivestreams>
75-
<reactor>${reactor}</reactor>
76-
</attributes>
77-
</configuration>
47+
<groupId>org.apache.maven.plugins</groupId>
48+
<artifactId>maven-assembly-plugin</artifactId>
49+
</plugin>
50+
<plugin>
51+
<groupId>io.spring.maven.antora</groupId>
52+
<artifactId>antora-maven-plugin</artifactId>
7853
</plugin>
7954
</plugins>
8055

src/main/antora/antora-playbook.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# PACKAGES [email protected] @antora/atlas-extension:1.0.0-alpha.1 @antora/[email protected] @springio/[email protected] @asciidoctor/[email protected] @opendevise/[email protected]
2+
#
3+
# The purpose of this Antora playbook is to build the docs in the current branch.
4+
antora:
5+
extensions:
6+
- '@antora/collector-extension'
7+
- require: '@springio/antora-extensions/root-component-extension'
8+
root_component_name: 'data-mongodb'
9+
site:
10+
title: Spring Data MongoDB
11+
url: https://docs.spring.io/spring-data-mongodb/reference/
12+
content:
13+
sources:
14+
- url: ./../../..
15+
branches: HEAD
16+
start_path: src/main/antora
17+
worktrees: true
18+
- url: https://github.com/spring-projects/spring-data-commons
19+
# Refname matching:
20+
# https://docs.antora.org/antora/latest/playbook/content-refname-matching/
21+
branches: [ main, 3.2.x ]
22+
start_path: src/main/antora
23+
asciidoc:
24+
attributes:
25+
page-pagination: ''
26+
hide-uri-scheme: '@'
27+
tabs-sync-option: '@'
28+
chomp: 'all'
29+
extensions:
30+
- '@asciidoctor/tabs'
31+
- '@springio/asciidoctor-extensions'
32+
sourcemap: true
33+
urls:
34+
latest_version_segment: ''
35+
runtime:
36+
log:
37+
failure_level: warn
38+
format: pretty
39+
ui:
40+
bundle:
41+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
42+
snapshot: true

src/main/antora/antora.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: data-mongodb
2+
version: true
3+
title: Spring Data MongoDB
4+
nav:
5+
- modules/ROOT/nav.adoc
6+
ext:
7+
collector:
8+
- run:
9+
command: ./mvnw validate process-resources -pl :spring-data-mongodb-distribution -am -Pantora-process-resources
10+
local: true
11+
scan:
12+
dir: spring-data-mongodb-distribution/target/classes/
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// tag::file[]
17+
package org.springframework.data.mongodb.example;
18+
19+
import static org.springframework.data.mongodb.core.query.Criteria.where;
20+
import static org.springframework.data.mongodb.core.query.Query.query;
21+
22+
import org.springframework.data.mongodb.core.MongoOperations;
23+
import org.springframework.data.mongodb.core.MongoTemplate;
24+
import org.springframework.data.mongodb.core.query.Query;
25+
26+
import com.mongodb.client.MongoClients;
27+
28+
public class MongoApplication {
29+
30+
public static void main(String[] args) throws Exception {
31+
32+
MongoOperations mongoOps = new MongoTemplate(MongoClients.create(), "database");
33+
mongoOps.insert(new Person("Joe", 34));
34+
35+
System.out.println(mongoOps.query(Person.class).matching(where("name").is("Joe")).firstValue());
36+
37+
mongoOps.dropCollection("person");
38+
}
39+
}
40+
//end::file[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// tag::file[]
17+
package org.springframework.data.mongodb.example;
18+
19+
// tag::class[]
20+
public class Person {
21+
22+
private String id;
23+
private String name;
24+
private int age;
25+
26+
public Person(String name, int age) {
27+
this.name = name;
28+
this.age = age;
29+
}
30+
31+
public String getId() {
32+
return id;
33+
}
34+
35+
public String getName() {
36+
return name;
37+
}
38+
39+
public int getAge() {
40+
return age;
41+
}
42+
43+
@Override
44+
public String toString() {
45+
return "Person [id=" + id + ", name=" + name + ", age=" + age + "]";
46+
}
47+
}
48+
// end::class[]
49+
// end::file[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// tag::file[]
17+
package org.springframework.data.mongodb.example;
18+
19+
import static org.springframework.data.mongodb.core.query.Criteria.*;
20+
import static org.springframework.data.mongodb.core.query.Query.*;
21+
22+
import org.springframework.data.mongodb.core.ReactiveMongoOperations;
23+
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
24+
25+
import com.mongodb.reactivestreams.client.MongoClients;
26+
27+
public class ReactiveMongoApplication {
28+
29+
public static void main(String[] args) throws Exception {
30+
31+
ReactiveMongoOperations mongoOps = new ReactiveMongoTemplate(MongoClients.create(), "database");
32+
33+
mongoOps.insert(new Person("Joe", 34))
34+
.then(mongoOps.query(Person.class).matching(where("name").is("Joe")).first())
35+
.doOnNext(System.out::println)
36+
.block();
37+
38+
mongoOps.dropCollection("person").block();
39+
}
40+
}
41+
// end::file[]

0 commit comments

Comments
 (0)