1<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/maven-v4_0_0.xsd"> 2 <modelVersion>4.0.0</modelVersion> 3 4 <parent> 5 <groupId>com.google.code.gson</groupId> 6 <artifactId>gson-parent</artifactId> 7 <version>2.10.1</version> 8 </parent> 9 10 <artifactId>gson</artifactId> 11 <name>Gson</name> 12 13 <licenses> 14 <license> 15 <name>Apache-2.0</name> 16 <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> 17 </license> 18 </licenses> 19 20 <properties> 21 <excludeTestCompilation>**/Java17*</excludeTestCompilation> 22 </properties> 23 24 <dependencies> 25 <dependency> 26 <groupId>junit</groupId> 27 <artifactId>junit</artifactId> 28 <scope>test</scope> 29 </dependency> 30 </dependencies> 31 32 <build> 33 <plugins> 34 <!-- 35 Plugins for source generation and compilation 36 --> 37 <plugin> 38 <groupId>org.codehaus.mojo</groupId> 39 <artifactId>templating-maven-plugin</artifactId> 40 <version>1.0.0</version> 41 <executions> 42 <execution> 43 <id>filtering-java-templates</id> 44 <goals> 45 <goal>filter-sources</goal> 46 </goals> 47 <configuration> 48 <sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory> 49 <outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory> 50 </configuration> 51 </execution> 52 </executions> 53 </plugin> 54 <plugin> 55 <groupId>org.apache.maven.plugins</groupId> 56 <artifactId>maven-compiler-plugin</artifactId> 57 <executions> 58 <execution> 59 <id>default-compile</id> 60 <configuration> 61 <excludes> 62 <!-- module-info.java is compiled using ModiTect --> 63 <exclude>module-info.java</exclude> 64 </excludes> 65 </configuration> 66 </execution> 67 <execution> 68 <id>default-testCompile</id> 69 <phase>test-compile</phase> 70 <goals> 71 <goal>testCompile</goal> 72 </goals> 73 <configuration> 74 <testExcludes> 75 <exclude>${excludeTestCompilation}</exclude> 76 </testExcludes> 77 </configuration> 78 </execution> 79 </executions> 80 </plugin> 81 <plugin> 82 <groupId>biz.aQute.bnd</groupId> 83 <artifactId>bnd-maven-plugin</artifactId> 84 <version>6.4.0</version> 85 <executions> 86 <execution> 87 <goals> 88 <goal>bnd-process</goal> 89 </goals> 90 </execution> 91 </executions> 92 </plugin> 93 94 <!-- 95 Plugins for test execution 96 --> 97 <plugin> 98 <groupId>org.apache.maven.plugins</groupId> 99 <artifactId>maven-surefire-plugin</artifactId> 100 <version>3.0.0-M7</version> 101 <configuration> 102 <!-- Deny illegal access, this is required for ReflectionAccessTest --> 103 <!-- Requires Java >= 9; Important: In case future Java versions 104 don't support this flag anymore, don't remove it unless CI also runs with 105 that Java version. Ideally would use toolchain to specify that this should 106 run with e.g. Java 11, but Maven toolchain requirements (unlike Gradle ones) 107 don't seem to be portable (every developer would have to set up toolchain 108 configuration locally). --> 109 <argLine>--illegal-access=deny</argLine> 110 </configuration> 111 </plugin> 112 <plugin> 113 <groupId>com.coderplus.maven.plugins</groupId> 114 <artifactId>copy-rename-maven-plugin</artifactId> 115 <version>1.0.1</version> 116 <executions> 117 <execution> 118 <id>pre-obfuscate-class</id> 119 <phase>process-test-classes</phase> 120 <goals> 121 <goal>rename</goal> 122 </goals> 123 <configuration> 124 <fileSets> 125 <fileSet> 126 <sourceFile>${project.build.directory}/test-classes/com/google/gson/functional/EnumWithObfuscatedTest.class</sourceFile> 127 <destinationFile>${project.build.directory}/test-classes-obfuscated-injar/com/google/gson/functional/EnumWithObfuscatedTest.class</destinationFile> 128 </fileSet> 129 <fileSet> 130 <sourceFile>${project.build.directory}/test-classes/com/google/gson/functional/EnumWithObfuscatedTest$Gender.class</sourceFile> 131 <destinationFile>${project.build.directory}/test-classes-obfuscated-injar/com/google/gson/functional/EnumWithObfuscatedTest$Gender.class</destinationFile> 132 </fileSet> 133 </fileSets> 134 </configuration> 135 </execution> 136 </executions> 137 </plugin> 138 <plugin> 139 <groupId>com.github.wvengen</groupId> 140 <artifactId>proguard-maven-plugin</artifactId> 141 <version>2.6.0</version> 142 <executions> 143 <execution> 144 <id>obfuscate-test-class</id> 145 <phase>process-test-classes</phase> 146 <goals> 147 <goal>proguard</goal> 148 </goals> 149 </execution> 150 </executions> 151 <configuration> 152 <obfuscate>true</obfuscate> 153 <injar>test-classes-obfuscated-injar</injar> 154 <outjar>test-classes-obfuscated-outjar</outjar> 155 <inFilter>**/*.class</inFilter> 156 <proguardInclude>${basedir}/src/test/resources/testcases-proguard.conf</proguardInclude> 157 <libs> 158 <lib>${project.build.directory}/classes</lib> 159 <lib>${java.home}/jmods/java.base.jmod</lib> 160 </libs> 161 </configuration> 162 </plugin> 163 <plugin> 164 <artifactId>maven-resources-plugin</artifactId> 165 <version>3.3.0</version> 166 <executions> 167 <execution> 168 <id>post-obfuscate-class</id> 169 <phase>process-test-classes</phase> 170 <goals> 171 <goal>copy-resources</goal> 172 </goals> 173 <configuration> 174 <outputDirectory>${project.build.directory}/test-classes/com/google/gson/functional</outputDirectory> 175 <resources> 176 <resource> 177 <directory>${project.build.directory}/test-classes-obfuscated-outjar/com/google/gson/functional</directory> 178 <includes> 179 <include>EnumWithObfuscatedTest.class</include> 180 <include>EnumWithObfuscatedTest$Gender.class</include> 181 </includes> 182 </resource> 183 </resources> 184 </configuration> 185 </execution> 186 </executions> 187 </plugin> 188 189 <!-- 190 Plugins for building / modifying artifacts 191 --> 192 <plugin> 193 <groupId>org.apache.maven.plugins</groupId> 194 <artifactId>maven-jar-plugin</artifactId> 195 <configuration> 196 <archive> 197 <!-- Use existing manifest generated by BND plugin --> 198 <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> 199 </archive> 200 </configuration> 201 </plugin> 202 <!-- Add module-info to JAR, see https://github.com/moditect/moditect#adding-module-descriptors-to-existing-jar-files --> 203 <!-- Uses ModiTect instead of separate maven-compiler-plugin executions 204 for better Eclipse IDE support, see https://github.com/eclipse-m2e/m2e-core/issues/393 --> 205 <!-- Note: For some reason this has to be executed before javadoc plugin; otherwise `javadoc:jar` goal fails 206 to find source files --> 207 <plugin> 208 <groupId>org.moditect</groupId> 209 <artifactId>moditect-maven-plugin</artifactId> 210 <version>1.0.0.RC2</version> 211 <executions> 212 <execution> 213 <id>add-module-info</id> 214 <phase>package</phase> 215 <goals> 216 <goal>add-module-info</goal> 217 </goals> 218 <configuration> 219 <jvmVersion>9</jvmVersion> 220 <module> 221 <moduleInfoFile>${project.build.sourceDirectory}/module-info.java</moduleInfoFile> 222 </module> 223 <!-- Overwrite the previously generated JAR file, if any --> 224 <overwriteExistingFiles>true</overwriteExistingFiles> 225 </configuration> 226 </execution> 227 </executions> 228 </plugin> 229 <!-- Note: Javadoc plugin has to be run in combination with >= `package` phase, 230 e.g. `mvn package javadoc:javadoc`, otherwise it fails with 231 "Aggregator report contains named and unnamed modules" --> 232 <plugin> 233 <groupId>org.apache.maven.plugins</groupId> 234 <artifactId>maven-javadoc-plugin</artifactId> 235 <configuration> 236 <excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames> 237 </configuration> 238 </plugin> 239 </plugins> 240 </build> 241 <profiles> 242 <profile> 243 <id>JDK17</id> 244 <activation> 245 <jdk>[17,)</jdk> 246 </activation> 247 <properties> 248 <maven.compiler.testRelease>17</maven.compiler.testRelease> 249 <excludeTestCompilation /> 250 </properties> 251 </profile> 252 </profiles> 253</project> 254