Skip to content

Commit 86495e2

Browse files
committed
Enforce spotless when building cover-annotations
1 parent d5f2ad7 commit 86495e2

File tree

2 files changed

+151
-91
lines changed

2 files changed

+151
-91
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Annotations placed on packages affect tests for all classes and methods under te
4343
Annotations placed on classes affect tests for that class and all it's methods under test, overriding package level annotations.
4444
Annotations placed on methods affect just that method under test, overriding package and class level annotations.
4545

46-
| Annotation | Equivalent `dcover create` option |
47-
|:----------------------------|:--------------------------------------------------|
48-
| `@InTestsMock` | `--mock`, `--disable-mock-inputs` |
49-
| `@InTestsMockConstruction` | `--mock-construction` |
50-
| `@InTestsMockStatic` | `--mock-static` |
46+
| Annotation | Equivalent `dcover create` option |
47+
|:---------------------------|:----------------------------------|
48+
| `@InTestsMock` | `--mock`, `--disable-mock-inputs` |
49+
| `@InTestsMockConstruction` | `--mock-construction` |
50+
| `@InTestsMockStatic` | `--mock-static` |
5151

5252
The annotations will be respected by Diffblue Cover via both command line and IntelliJ Plugin.
5353
When used from the command line in conjunction with equivalent options then the command line options take priority over the annotations found.
@@ -104,3 +104,4 @@ public class ClassUnderTest {
104104
}
105105
}
106106
```
107+

pom.xml

Lines changed: 145 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@
1212
~ express or implied. See the License for the specific language governing
1313
~ permissions and limitations under the License.
1414
-->
15-
<project xmlns="http://maven.apache.org/POM/4.0.0"
16-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
15+
<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">
1816
<modelVersion>4.0.0</modelVersion>
1917
<groupId>com.diffblue.cover</groupId>
2018
<artifactId>cover-annotations</artifactId>
2119
<version>1.0.0</version>
2220
<packaging>jar</packaging>
2321

2422
<name>Cover Annotations</name>
25-
<description>
26-
Annotations for end users to enable fine-grained control of Diffblue Cover.
27-
</description>
23+
<description>Annotations for end users to enable fine-grained control of Diffblue Cover.</description>
2824
<url>https://www.diffblue.com/</url>
2925

3026
<licenses>
@@ -45,103 +41,166 @@
4541
</developers>
4642

4743
<scm>
48-
<url>https://github.com/diffblue/cover-annotations</url>
4944
<connection>scm:git:git://github.com/diffblue/cover-annotations.git</connection>
45+
<url>https://github.com/diffblue/cover-annotations</url>
5046
</scm>
5147

48+
<distributionManagement>
49+
<snapshotRepository>
50+
<id>ossrh</id>
51+
<!-- nb this must be the same as the 'id' field in 'settings.xml' -->
52+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
53+
</snapshotRepository>
54+
</distributionManagement>
55+
5256
<properties>
5357
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5458
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5559
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
5660
<maven.javadoc.plugin.version>3.6.3</maven.javadoc.plugin.version>
5761
<maven.source.plugin.version>3.3.0</maven.source.plugin.version>
62+
<maven.spotless.plugin.version>2.43.0</maven.spotless.plugin.version>
63+
<google.java.format.version>1.17.0</google.java.format.version>
5864
<gpg.plugin.version>3.2.1</gpg.plugin.version>
5965
</properties>
6066

61-
<distributionManagement>
62-
<snapshotRepository>
63-
<id>ossrh</id><!-- nb this must be the same as the 'id' field in 'settings.xml' -->
64-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
65-
</snapshotRepository>
66-
</distributionManagement>
67-
6867
<profiles>
69-
<profile>
70-
<id>stdbuild</id>
71-
<activation>
72-
<activeByDefault>true</activeByDefault>
73-
</activation>
74-
<build>
68+
<profile>
69+
<id>stdbuild</id>
70+
<activation>
71+
<activeByDefault>true</activeByDefault>
72+
</activation>
73+
<build>
74+
<plugins>
7575

76-
<plugins>
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-compiler-plugin</artifactId>
79+
<version>${maven.compiler.plugin.version}</version>
80+
<configuration>
81+
<source>1.8</source>
82+
<target>1.8</target>
83+
<release>8</release>
84+
</configuration>
85+
</plugin>
7786

78-
<plugin>
79-
<groupId>org.apache.maven.plugins</groupId>
80-
<artifactId>maven-compiler-plugin</artifactId>
81-
<version>${maven.compiler.plugin.version}</version>
82-
<configuration>
83-
<source>1.8</source>
84-
<target>1.8</target>
85-
</configuration>
86-
</plugin>
87-
<!-- Source plugin to include sources in the final artifact -->
88-
<plugin>
89-
<groupId>org.apache.maven.plugins</groupId>
90-
<artifactId>maven-source-plugin</artifactId>
91-
<version>${maven.source.plugin.version}</version>
92-
<executions>
93-
<execution>
94-
<id>attach-sources</id>
95-
<goals>
96-
<goal>jar</goal>
97-
</goals>
98-
</execution>
99-
</executions>
100-
</plugin>
87+
<!-- Source plugin to include sources in the final artifact -->
88+
<plugin>
89+
<groupId>org.apache.maven.plugins</groupId>
90+
<artifactId>maven-source-plugin</artifactId>
91+
<version>${maven.source.plugin.version}</version>
92+
<executions>
93+
<execution>
94+
<id>attach-sources</id>
95+
<goals>
96+
<goal>jar</goal>
97+
</goals>
98+
</execution>
99+
</executions>
100+
</plugin>
101101

102-
<!-- Javadoc plugin to include Javadoc in the final artifact -->
103-
<plugin>
104-
<groupId>org.apache.maven.plugins</groupId>
105-
<artifactId>maven-javadoc-plugin</artifactId>
106-
<version>${maven.javadoc.plugin.version}</version>
107-
<executions>
108-
<execution>
109-
<id>attach-javadocs</id>
110-
<goals>
111-
<goal>jar</goal>
112-
</goals>
113-
</execution>
114-
</executions>
115-
</plugin>
116-
</plugins>
117-
</build>
118-
</profile>
119-
<profile>
120-
<id>sign</id>
121-
<activation>
122-
<activeByDefault>false</activeByDefault>
123-
</activation>
124-
<build>
125-
<plugins>
126-
<!-- GPG Plugin for signing artifacts -->
127-
<plugin>
128-
<groupId>org.apache.maven.plugins</groupId>
129-
<artifactId>maven-gpg-plugin</artifactId>
130-
<version>${gpg.plugin.version}</version>
131-
<executions>
132-
<execution>
133-
<id>sign-artifacts</id>
134-
<phase>verify</phase>
135-
<goals>
136-
<goal>sign</goal>
137-
</goals>
138-
</execution>
139-
</executions>
140-
</plugin>
102+
<!-- Javadoc plugin to include Javadoc in the final artifact -->
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-javadoc-plugin</artifactId>
106+
<version>${maven.javadoc.plugin.version}</version>
107+
<executions>
108+
<execution>
109+
<id>attach-javadocs</id>
110+
<goals>
111+
<goal>jar</goal>
112+
</goals>
113+
<configuration>
114+
<source>8</source>
115+
</configuration>
116+
</execution>
117+
</executions>
118+
</plugin>
119+
120+
<plugin>
121+
<groupId>com.diffplug.spotless</groupId>
122+
<artifactId>spotless-maven-plugin</artifactId>
123+
<version>${maven.spotless.plugin.version}</version>
124+
<configuration>
125+
<ratchetFrom>origin/main</ratchetFrom>
126+
<pom>
127+
<includes>
128+
<include>**/pom.xml</include>
129+
</includes>
130+
<sortPom></sortPom>
131+
</pom>
132+
<java>
133+
<includes>
134+
<include>**/*.java</include>
135+
</includes>
136+
<licenseHeader>
137+
<content>/*
138+
* Copyright $YEAR Diffblue Limited.
139+
*
140+
* Licensed under the Apache License, Version 2.0 (the "License").
141+
* You may not use this file except in compliance with the License.
142+
* A copy of the License is located at
143+
*
144+
* https://www.apache.org/licenses/LICENSE-2.0
145+
*
146+
* or in the "license" file accompanying this file. This file is distributed
147+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
148+
* express or implied. See the License for the specific language governing
149+
* permissions and limitations under the License.
150+
*/</content>
151+
<delimiter>package</delimiter>
152+
</licenseHeader>
153+
<googleJavaFormat>
154+
<version>${google.java.format.version}</version>
155+
<style>GOOGLE</style>
156+
</googleJavaFormat>
157+
</java>
158+
<markdown>
159+
<includes>
160+
<include>**/*.md</include>
161+
</includes>
162+
<flexmark></flexmark>
163+
</markdown>
164+
</configuration>
165+
<executions>
166+
<execution>
167+
<id>default-cli</id>
168+
<goals>
169+
<goal>apply</goal>
170+
</goals>
171+
<phase>generate-sources</phase>
172+
</execution>
173+
</executions>
174+
</plugin>
141175

142-
</plugins>
143-
</build>
144-
</profile>
176+
</plugins>
177+
</build>
178+
</profile>
179+
<profile>
180+
<id>sign</id>
181+
<activation>
182+
<activeByDefault>false</activeByDefault>
183+
</activation>
184+
<build>
185+
<plugins>
186+
<!-- GPG Plugin for signing artifacts -->
187+
<plugin>
188+
<groupId>org.apache.maven.plugins</groupId>
189+
<artifactId>maven-gpg-plugin</artifactId>
190+
<version>${gpg.plugin.version}</version>
191+
<executions>
192+
<execution>
193+
<id>sign-artifacts</id>
194+
<goals>
195+
<goal>sign</goal>
196+
</goals>
197+
<phase>verify</phase>
198+
</execution>
199+
</executions>
200+
</plugin>
201+
</plugins>
202+
</build>
203+
</profile>
145204
</profiles>
146205

147206
</project>

0 commit comments

Comments
 (0)