|
27 | 27 |
|
28 | 28 | <build>
|
29 | 29 | <plugins>
|
| 30 | + <!-- |
| 31 | + Plugins for source generation and compilation |
| 32 | + --> |
30 | 33 | <plugin>
|
31 |
| - <groupId>org.apache.maven.plugins</groupId> |
32 |
| - <artifactId>maven-compiler-plugin</artifactId> |
| 34 | + <groupId>org.codehaus.mojo</groupId> |
| 35 | + <artifactId>templating-maven-plugin</artifactId> |
| 36 | + <version>1.0.0</version> |
33 | 37 | <executions>
|
34 | 38 | <execution>
|
35 |
| - <id>default-compile</id> |
| 39 | + <id>filtering-java-templates</id> |
| 40 | + <goals> |
| 41 | + <goal>filter-sources</goal> |
| 42 | + </goals> |
36 | 43 | <configuration>
|
37 |
| - <excludes> |
38 |
| - <!-- module-info.java is compiled using ModiTect --> |
39 |
| - <exclude>module-info.java</exclude> |
40 |
| - </excludes> |
| 44 | + <sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory> |
| 45 | + <outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory> |
41 | 46 | </configuration>
|
42 | 47 | </execution>
|
43 | 48 | </executions>
|
44 | 49 | </plugin>
|
45 |
| - <!-- Note: Javadoc plugin has to be run in combination with >= `package` |
46 |
| - phase, e.g. `mvn package javadoc:javadoc`, otherwise it fails with |
47 |
| - "Aggregator report contains named and unnamed modules" --> |
48 | 50 | <plugin>
|
49 | 51 | <groupId>org.apache.maven.plugins</groupId>
|
50 |
| - <artifactId>maven-surefire-plugin</artifactId> |
51 |
| - <version>3.0.0-M7</version> |
52 |
| - <configuration> |
53 |
| - <!-- Deny illegal access, this is required for ReflectionAccessTest --> |
54 |
| - <!-- Requires Java >= 9; Important: In case future Java versions |
55 |
| - don't support this flag anymore, don't remove it unless CI also runs with |
56 |
| - that Java version. Ideally would use toolchain to specify that this should |
57 |
| - run with e.g. Java 11, but Maven toolchain requirements (unlike Gradle ones) |
58 |
| - don't seem to be portable (every developer would have to set up toolchain |
59 |
| - configuration locally). --> |
60 |
| - <argLine>--illegal-access=deny</argLine> |
61 |
| - </configuration> |
62 |
| - </plugin> |
63 |
| - <plugin> |
64 |
| - <groupId>org.apache.maven.plugins</groupId> |
65 |
| - <artifactId>maven-javadoc-plugin</artifactId> |
66 |
| - <configuration> |
67 |
| - <excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames> |
68 |
| - </configuration> |
69 |
| - </plugin> |
70 |
| - <!-- Add module-info to JAR, see https://github.com/moditect/moditect#adding-module-descriptors-to-existing-jar-files --> |
71 |
| - <!-- Uses ModiTect instead of separate maven-compiler-plugin executions |
72 |
| - for better Eclipse IDE support, see https://github.com/eclipse-m2e/m2e-core/issues/393 --> |
73 |
| - <plugin> |
74 |
| - <groupId>org.moditect</groupId> |
75 |
| - <artifactId>moditect-maven-plugin</artifactId> |
76 |
| - <version>1.0.0.RC2</version> |
| 52 | + <artifactId>maven-compiler-plugin</artifactId> |
77 | 53 | <executions>
|
78 | 54 | <execution>
|
79 |
| - <id>add-module-info</id> |
80 |
| - <phase>package</phase> |
81 |
| - <goals> |
82 |
| - <goal>add-module-info</goal> |
83 |
| - </goals> |
| 55 | + <id>default-compile</id> |
84 | 56 | <configuration>
|
85 |
| - <jvmVersion>9</jvmVersion> |
86 |
| - <module> |
87 |
| - <moduleInfoFile>${project.build.sourceDirectory}/module-info.java</moduleInfoFile> |
88 |
| - </module> |
89 |
| - <!-- Overwrite the previously generated JAR file, if any --> |
90 |
| - <overwriteExistingFiles>true</overwriteExistingFiles> |
| 57 | + <excludes> |
| 58 | + <!-- module-info.java is compiled using ModiTect --> |
| 59 | + <exclude>module-info.java</exclude> |
| 60 | + </excludes> |
91 | 61 | </configuration>
|
92 | 62 | </execution>
|
93 | 63 | </executions>
|
|
104 | 74 | </execution>
|
105 | 75 | </executions>
|
106 | 76 | </plugin>
|
| 77 | + |
| 78 | + <!-- |
| 79 | + Plugins for test execution |
| 80 | + --> |
107 | 81 | <plugin>
|
108 | 82 | <groupId>org.apache.maven.plugins</groupId>
|
109 |
| - <artifactId>maven-jar-plugin</artifactId> |
| 83 | + <artifactId>maven-surefire-plugin</artifactId> |
| 84 | + <version>3.0.0-M7</version> |
110 | 85 | <configuration>
|
111 |
| - <archive> |
112 |
| - <!-- Use existing manifest generated by BND plugin --> |
113 |
| - <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> |
114 |
| - </archive> |
| 86 | + <!-- Deny illegal access, this is required for ReflectionAccessTest --> |
| 87 | + <!-- Requires Java >= 9; Important: In case future Java versions |
| 88 | + don't support this flag anymore, don't remove it unless CI also runs with |
| 89 | + that Java version. Ideally would use toolchain to specify that this should |
| 90 | + run with e.g. Java 11, but Maven toolchain requirements (unlike Gradle ones) |
| 91 | + don't seem to be portable (every developer would have to set up toolchain |
| 92 | + configuration locally). --> |
| 93 | + <argLine>--illegal-access=deny</argLine> |
115 | 94 | </configuration>
|
116 | 95 | </plugin>
|
117 |
| - <plugin> |
118 |
| - <groupId>org.codehaus.mojo</groupId> |
119 |
| - <artifactId>templating-maven-plugin</artifactId> |
120 |
| - <version>1.0.0</version> |
121 |
| - <executions> |
122 |
| - <execution> |
123 |
| - <id>filtering-java-templates</id> |
124 |
| - <goals> |
125 |
| - <goal>filter-sources</goal> |
126 |
| - </goals> |
127 |
| - <configuration> |
128 |
| - <sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory> |
129 |
| - <outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory> |
130 |
| - </configuration> |
131 |
| - </execution> |
132 |
| - </executions> |
133 |
| - </plugin> |
134 | 96 | <plugin>
|
135 | 97 | <groupId>com.coderplus.maven.plugins</groupId>
|
136 | 98 | <artifactId>copy-rename-maven-plugin</artifactId>
|
|
163 | 125 | <version>2.6.0</version>
|
164 | 126 | <executions>
|
165 | 127 | <execution>
|
| 128 | + <id>obfuscate-test-class</id> |
166 | 129 | <phase>process-test-classes</phase>
|
167 | 130 | <goals>
|
168 | 131 | <goal>proguard</goal>
|
|
206 | 169 | </execution>
|
207 | 170 | </executions>
|
208 | 171 | </plugin>
|
| 172 | + |
| 173 | + <!-- |
| 174 | + Plugins for building / modifying artifacts |
| 175 | + --> |
| 176 | + <plugin> |
| 177 | + <groupId>org.apache.maven.plugins</groupId> |
| 178 | + <artifactId>maven-jar-plugin</artifactId> |
| 179 | + <configuration> |
| 180 | + <archive> |
| 181 | + <!-- Use existing manifest generated by BND plugin --> |
| 182 | + <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> |
| 183 | + </archive> |
| 184 | + </configuration> |
| 185 | + </plugin> |
| 186 | + <!-- Add module-info to JAR, see https://github.com/moditect/moditect#adding-module-descriptors-to-existing-jar-files --> |
| 187 | + <!-- Uses ModiTect instead of separate maven-compiler-plugin executions |
| 188 | + for better Eclipse IDE support, see https://github.com/eclipse-m2e/m2e-core/issues/393 --> |
| 189 | + <!-- Note: For some reason this has to be executed before javadoc plugin; otherwise `javadoc:jar` goal fails |
| 190 | + to find source files --> |
| 191 | + <plugin> |
| 192 | + <groupId>org.moditect</groupId> |
| 193 | + <artifactId>moditect-maven-plugin</artifactId> |
| 194 | + <version>1.0.0.RC2</version> |
| 195 | + <executions> |
| 196 | + <execution> |
| 197 | + <id>add-module-info</id> |
| 198 | + <phase>package</phase> |
| 199 | + <goals> |
| 200 | + <goal>add-module-info</goal> |
| 201 | + </goals> |
| 202 | + <configuration> |
| 203 | + <jvmVersion>9</jvmVersion> |
| 204 | + <module> |
| 205 | + <moduleInfoFile>${project.build.sourceDirectory}/module-info.java</moduleInfoFile> |
| 206 | + </module> |
| 207 | + <!-- Overwrite the previously generated JAR file, if any --> |
| 208 | + <overwriteExistingFiles>true</overwriteExistingFiles> |
| 209 | + </configuration> |
| 210 | + </execution> |
| 211 | + </executions> |
| 212 | + </plugin> |
| 213 | + <!-- Note: Javadoc plugin has to be run in combination with >= `package` phase, |
| 214 | + e.g. `mvn package javadoc:javadoc`, otherwise it fails with |
| 215 | + "Aggregator report contains named and unnamed modules" --> |
| 216 | + <plugin> |
| 217 | + <groupId>org.apache.maven.plugins</groupId> |
| 218 | + <artifactId>maven-javadoc-plugin</artifactId> |
| 219 | + <configuration> |
| 220 | + <excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames> |
| 221 | + </configuration> |
| 222 | + </plugin> |
209 | 223 | </plugins>
|
210 | 224 | </build>
|
211 | 225 | </project>
|
0 commit comments