Skip to content

Commit d2518d0

Browse files
committed
Allow to give alternative source directories for sites
Add ITs for verifying edit link This relates to apache/maven-doxia-sitetools#277
1 parent dd33bb2 commit d2518d0

17 files changed

Lines changed: 572 additions & 14 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ under the License.
2929
</parent>
3030

3131
<artifactId>maven-site-plugin</artifactId>
32-
<version>3.21.1-SNAPSHOT</version>
32+
<version>3.22.0-SNAPSHOT</version>
3333
<packaging>maven-plugin</packaging>
3434

3535
<name>Apache Maven Site Plugin</name>
@@ -199,7 +199,7 @@ under the License.
199199
<!-- for dependencies -->
200200
<jettyVersion>9.4.58.v20250814</jettyVersion>
201201
<doxiaVersion>2.0.0</doxiaVersion>
202-
<doxiaSitetoolsVersion>2.0.0</doxiaSitetoolsVersion>
202+
<doxiaSitetoolsVersion>2.1.0</doxiaSitetoolsVersion>
203203
<wagonVersion>3.5.3</wagonVersion>
204204
<slf4jVersion>1.7.36</slf4jVersion>
205205
<!-- for ITs -->
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
invoker.goals = package site
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<groupId>org.apache.maven.plugins.site.its</groupId>
27+
<artifactId>editable-pages-alt-source</artifactId>
28+
<version>1.0-SNAPSHOT</version>
29+
<packaging>jar</packaging>
30+
<name>Edit Link Alternative Source IT</name>
31+
32+
<properties>
33+
<property-project-version>@project.version@</property-project-version>
34+
<fluidoSkinVersion>@fluidoSkinVersion@</fluidoSkinVersion>
35+
<project.build.outputTimestamp>@project.build.outputTimestamp@</project.build.outputTimestamp>
36+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
37+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
38+
<myProperty>myValue</myProperty>
39+
</properties>
40+
41+
<build>
42+
<pluginManagement>
43+
<plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-site-plugin</artifactId>
47+
<version>@project.version@</version>
48+
<configuration>
49+
<generateReports>true</generateReports>
50+
<relativizeDecorationLinks>false</relativizeDecorationLinks>
51+
<siteDirectory>${project.build.directory}/site-src</siteDirectory>
52+
<alternativeSiteSourceDirectories>${basedir}/src/site</alternativeSiteSourceDirectories>
53+
</configuration>
54+
</plugin>
55+
</plugins>
56+
</pluginManagement>
57+
<plugins>
58+
<plugin>
59+
<!-- prepare site content by filtering ${project.*} values -->
60+
<groupId>org.apache.maven.plugins</groupId>
61+
<artifactId>maven-resources-plugin</artifactId>
62+
<executions>
63+
<execution>
64+
<id>filter-site</id>
65+
<phase>pre-site</phase>
66+
<goals>
67+
<goal>copy-resources</goal>
68+
</goals>
69+
<configuration>
70+
<outputDirectory>${project.build.directory}/site-src</outputDirectory>
71+
<resources>
72+
<resource>
73+
<directory>src/site</directory>
74+
<filtering>true</filtering>
75+
</resource>
76+
</resources>
77+
</configuration>
78+
</execution>
79+
<execution>
80+
<id>default-testResources</id>
81+
<configuration>
82+
<!-- copy .gitignore as well -->
83+
<addDefaultExcludes>false</addDefaultExcludes>
84+
</configuration>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
91+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
~~ NOTE: For help with the syntax of this file, see:
19+
~~ http://maven.apache.org/doxia/references/apt-format.html
20+
21+
Markdown
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
title: Markdown Title Metadata
2+
author: Author Metadata
3+
date: Date Metadata
4+
description: Markdown description metadata, not known from Doxia API as title, author and date are
5+
6+
<!---
7+
Licensed to the Apache Software Foundation (ASF) under one
8+
or more contributor license agreements. See the NOTICE file
9+
distributed with this work for additional information
10+
regarding copyright ownership. The ASF licenses this file
11+
to you under the Apache License, Version 2.0 (the
12+
"License"); you may not use this file except in compliance
13+
with the License. You may obtain a copy of the License at
14+
15+
http://www.apache.org/licenses/LICENSE-2.0
16+
17+
Unless required by applicable law or agreed to in writing,
18+
software distributed under the License is distributed on an
19+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20+
KIND, either express or implied. See the License for the
21+
specific language governing permissions and limitations
22+
under the License.
23+
-->
24+
25+
Markdown ${myProperty}
26+
=====================
27+
28+
Subsection
29+
----------
30+
31+
This is a subsection.
32+
33+
Content for verify.groovy
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
<site xmlns="http://maven.apache.org/SITE/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/SITE/2.0.0 https://maven.apache.org/xsd/site-2.0.0.xsd"
24+
name="${project.name}">
25+
<skin>
26+
<groupId>org.apache.maven.skins</groupId>
27+
<artifactId>maven-fluido-skin</artifactId>
28+
<version>${fluidoSkinVersion}</version>
29+
</skin>
30+
31+
<custom>
32+
<fluidoSkin>
33+
<sourceLineNumbersEnabled>true</sourceLineNumbersEnabled>
34+
</fluidoSkin>
35+
</custom>
36+
37+
<publishDate position="right" />
38+
<version position="right" />
39+
<edit>https://github.com/apache/maven-site-plugin/tree/master/</edit>
40+
41+
<body>
42+
<breadcrumbs>
43+
<item name="Editable Pages" href="index.html" />
44+
</breadcrumbs>
45+
</body>
46+
</site>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
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+
21+
def page = new File( basedir, 'target/site/markdown.html' )
22+
assert page.exists() : "$page must have been generated"
23+
def content = page.text
24+
25+
assert content.contains( '<a href="https://github.com/apache/maven-site-plugin/tree/master/src/site/markdown/markdown.md"><img src="./images/accessories-text-editor.png" alt="Edit" /></a>' ) : 'Found invalid edit link'
26+
assert content.contains( '<h1>Markdown myValue</h1>' ) : 'Found invalid headline'
27+
28+
29+
page = new File( basedir, 'target/site/index.html' )
30+
assert page.exists() : "$page must have been generated"
31+
content = page.text
32+
33+
assert !content.contains( '<img src="./images/accessories-text-editor.png" alt="Edit" />' ) : 'Found edit link for report that should not have it'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
invoker.goals = package site
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<groupId>org.apache.maven.plugins.site.its</groupId>
27+
<artifactId>editable-pages</artifactId>
28+
<version>1.0-SNAPSHOT</version>
29+
<packaging>jar</packaging>
30+
<name>Edit Link IT</name>
31+
32+
<properties>
33+
<property-project-version>@project.version@</property-project-version>
34+
<fluidoSkinVersion>@fluidoSkinVersion@</fluidoSkinVersion>
35+
<project.build.outputTimestamp>@project.build.outputTimestamp@</project.build.outputTimestamp>
36+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
37+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
38+
</properties>
39+
40+
<build>
41+
<pluginManagement>
42+
<plugins>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-site-plugin</artifactId>
46+
<version>@project.version@</version>
47+
<configuration>
48+
<generateReports>true</generateReports>
49+
<relativizeDecorationLinks>false</relativizeDecorationLinks>
50+
</configuration>
51+
</plugin>
52+
</plugins>
53+
</pluginManagement>
54+
</build>
55+
56+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
~~ NOTE: For help with the syntax of this file, see:
19+
~~ http://maven.apache.org/doxia/references/apt-format.html
20+
21+
Markdown

0 commit comments

Comments
 (0)