@rashidee/co2 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/index.js +25449 -0
  2. package/drizzle/0000_remarkable_charles_xavier.sql +210 -0
  3. package/drizzle/0001_wise_wolf_cub.sql +13 -0
  4. package/drizzle/0002_secret_spyke.sql +16 -0
  5. package/drizzle/0003_workspace_config_singleton.sql +16 -0
  6. package/drizzle/0004_terminal_claim_v120.sql +11 -0
  7. package/drizzle/0005_brainstorm_v124.sql +10 -0
  8. package/drizzle/0006_project_v140.sql +6 -0
  9. package/drizzle/0007_prd_wizard_v124.sql +14 -0
  10. package/drizzle/0008_workflow_artifact_v126.sql +24 -0
  11. package/drizzle/0009_project_import_v150.sql +7 -0
  12. package/drizzle/0010_quality_v151.sql +3 -0
  13. package/drizzle/meta/0000_snapshot.json +1335 -0
  14. package/drizzle/meta/0001_snapshot.json +1416 -0
  15. package/drizzle/meta/0002_snapshot.json +1510 -0
  16. package/drizzle/meta/_journal.json +83 -0
  17. package/package.json +41 -0
  18. package/plugin/.claude-plugin/marketplace.json +36 -0
  19. package/plugin/.claude-plugin/plugin.json +22 -0
  20. package/plugin/README.md +625 -0
  21. package/plugin/SKILLS.md +350 -0
  22. package/plugin/co2.svg +5 -0
  23. package/plugin/commands/brainstorm-loop.md +129 -0
  24. package/plugin/skills/conductor-defect/SKILL.md +898 -0
  25. package/plugin/skills/conductor-feature-develop/SKILL.md +1383 -0
  26. package/plugin/skills/conductor-feature-develop/references/implementation-domain-template.md +131 -0
  27. package/plugin/skills/conductor-feature-develop/references/implementation-master-template.md +89 -0
  28. package/plugin/skills/conductor-feature-develop/references/playwright-setup.md +224 -0
  29. package/plugin/skills/conductor-feature-prepare/SKILL.md +604 -0
  30. package/plugin/skills/depgen-k8s/SKILL.md +468 -0
  31. package/plugin/skills/depgen-k8s/references/dockerfile-laravel.md +197 -0
  32. package/plugin/skills/depgen-k8s/references/dockerfile-nodejs.md +163 -0
  33. package/plugin/skills/depgen-k8s/references/dockerfile-spring-boot.md +174 -0
  34. package/plugin/skills/depgen-k8s/references/k8s-patterns.md +869 -0
  35. package/plugin/skills/mockgen-shadcn/SKILL.md +1067 -0
  36. package/plugin/skills/mockgen-shadcn/references/admin-layout-template.md +1467 -0
  37. package/plugin/skills/mockgen-shadcn/references/mockup-hub-template.md +498 -0
  38. package/plugin/skills/mockgen-shadcn/references/mockup-index-template.md +216 -0
  39. package/plugin/skills/mockgen-tailwind/SKILL.md +904 -0
  40. package/plugin/skills/mockgen-tailwind/references/admin-layout-template.md +720 -0
  41. package/plugin/skills/mockgen-tailwind/references/mockup-hub-template.md +498 -0
  42. package/plugin/skills/mockgen-tailwind/references/mockup-index-template.md +190 -0
  43. package/plugin/skills/modelgen-nosql/SKILL.md +617 -0
  44. package/plugin/skills/modelgen-nosql/references/model-extraction-methodology.md +497 -0
  45. package/plugin/skills/modelgen-nosql/references/nosql-design-guide.md +258 -0
  46. package/plugin/skills/modelgen-relational/SKILL.md +707 -0
  47. package/plugin/skills/modelgen-relational/references/model-extraction-methodology.md +499 -0
  48. package/plugin/skills/specgen-flutter-riverpod/SKILL.md +898 -0
  49. package/plugin/skills/specgen-flutter-riverpod/references/component-patterns.md +971 -0
  50. package/plugin/skills/specgen-flutter-riverpod/references/notification-patterns.md +457 -0
  51. package/plugin/skills/specgen-flutter-riverpod/references/routing-patterns.md +362 -0
  52. package/plugin/skills/specgen-flutter-riverpod/references/security-patterns.md +709 -0
  53. package/plugin/skills/specgen-flutter-riverpod/references/spec-template.md +1566 -0
  54. package/plugin/skills/specgen-flutter-riverpod/references/state-patterns.md +518 -0
  55. package/plugin/skills/specgen-flutter-riverpod/references/storage-patterns.md +370 -0
  56. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/SKILL.md +984 -0
  57. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/batch-patterns.md +359 -0
  58. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/messaging-patterns.md +468 -0
  59. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/modulith-patterns.md +461 -0
  60. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/reporting-patterns.md +803 -0
  61. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/security-patterns.md +501 -0
  62. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/spec-template.md +1268 -0
  63. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/web-patterns.md +301 -0
  64. package/plugin/skills/specgen-node-cli-web/SKILL.md +561 -0
  65. package/plugin/skills/specgen-node-cli-web/references/auth-patterns.md +293 -0
  66. package/plugin/skills/specgen-node-cli-web/references/cli-packaging-patterns.md +250 -0
  67. package/plugin/skills/specgen-node-cli-web/references/server-patterns.md +247 -0
  68. package/plugin/skills/specgen-node-cli-web/references/spec-template.md +401 -0
  69. package/plugin/skills/specgen-node-cli-web/references/testing-patterns.md +174 -0
  70. package/plugin/skills/specgen-react-mui/SKILL.md +789 -0
  71. package/plugin/skills/specgen-react-mui/references/component-patterns.md +1077 -0
  72. package/plugin/skills/specgen-react-mui/references/reporting-patterns.md +1998 -0
  73. package/plugin/skills/specgen-react-mui/references/routing-patterns.md +461 -0
  74. package/plugin/skills/specgen-react-mui/references/security-patterns.md +599 -0
  75. package/plugin/skills/specgen-react-mui/references/spec-template.md +1030 -0
  76. package/plugin/skills/specgen-react-mui/references/state-patterns.md +327 -0
  77. package/plugin/skills/specgen-react-tailwind/SKILL.md +859 -0
  78. package/plugin/skills/specgen-react-tailwind/references/component-patterns.md +1212 -0
  79. package/plugin/skills/specgen-react-tailwind/references/reporting-patterns.md +1529 -0
  80. package/plugin/skills/specgen-react-tailwind/references/routing-patterns.md +669 -0
  81. package/plugin/skills/specgen-react-tailwind/references/security-patterns.md +656 -0
  82. package/plugin/skills/specgen-react-tailwind/references/spec-template.md +1237 -0
  83. package/plugin/skills/specgen-react-tailwind/references/state-patterns.md +327 -0
  84. package/plugin/skills/specgen-sdk-java/SKILL.md +933 -0
  85. package/plugin/skills/specgen-sdk-java/references/api-extraction-patterns.md +247 -0
  86. package/plugin/skills/specgen-sdk-java/references/http-client-patterns.md +495 -0
  87. package/plugin/skills/specgen-sdk-java/references/packaging-patterns.md +366 -0
  88. package/plugin/skills/specgen-sdk-java/references/spec-template.md +956 -0
  89. package/plugin/skills/specgen-spring-jpa-jtehtmx/SKILL.md +1284 -0
  90. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/batch-patterns.md +1224 -0
  91. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/jasper-patterns.md +1638 -0
  92. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/messaging-patterns.md +512 -0
  93. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/modulith-patterns.md +354 -0
  94. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/security-patterns.md +551 -0
  95. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/spec-template.md +2502 -0
  96. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/web-patterns.md +503 -0
  97. package/plugin/skills/specgen-spring-jpa-restapi/SKILL.md +990 -0
  98. package/plugin/skills/specgen-spring-jpa-restapi/references/batch-patterns.md +1224 -0
  99. package/plugin/skills/specgen-spring-jpa-restapi/references/messaging-patterns.md +512 -0
  100. package/plugin/skills/specgen-spring-jpa-restapi/references/modulith-patterns.md +279 -0
  101. package/plugin/skills/specgen-spring-jpa-restapi/references/reporting-patterns.md +1536 -0
  102. package/plugin/skills/specgen-spring-jpa-restapi/references/restapi-patterns.md +722 -0
  103. package/plugin/skills/specgen-spring-jpa-restapi/references/security-patterns.md +351 -0
  104. package/plugin/skills/specgen-spring-jpa-restapi/references/spec-template.md +553 -0
  105. package/plugin/skills/specgen-ts-cli/SKILL.md +861 -0
  106. package/plugin/skills/specgen-ts-cli/references/async-patterns.md +1101 -0
  107. package/plugin/skills/specgen-ts-cli/references/command-patterns.md +383 -0
  108. package/plugin/skills/specgen-ts-cli/references/config-patterns.md +430 -0
  109. package/plugin/skills/specgen-ts-cli/references/database-patterns.md +750 -0
  110. package/plugin/skills/specgen-ts-cli/references/packaging-patterns.md +426 -0
  111. package/plugin/skills/specgen-ts-cli/references/spec-template.md +1391 -0
  112. package/plugin/skills/specgen-ts-cli/references/testing-patterns.md +909 -0
  113. package/plugin/skills/testgen-functional/SKILL.md +1381 -0
  114. package/plugin/skills/tracegen-matrix/SKILL.md +243 -0
  115. package/plugin/skills/util-preparek8senv/SKILL.md +422 -0
  116. package/plugin/skills/util-projectinit/SKILL.md +307 -0
  117. package/plugin/skills/util-projectinit/reference/brainstorm-loop.md +129 -0
  118. package/plugin/skills/util-projectinit/reference/brainstorm-protocol.md +144 -0
  119. package/plugin/skills/util-projectinit/reference/brainstorm-setup-guide.md +153 -0
  120. package/plugin/skills/util-projectinit/reference/brainstorm-template-appdev.md +87 -0
  121. package/plugin/skills/util-projectinit/reference/co2-context-generation-guide.md +761 -0
  122. package/plugin/skills/util-projectsync/SKILL.md +501 -0
  123. package/plugin/skills/util-updprd/SKILL.md +324 -0
  124. package/plugin/skills/util-usanalyzer/SKILL.md +307 -0
  125. package/plugin/skills/util-ustagger/SKILL.md +154 -0
  126. package/static/assets/abnfDiagram-VRR7QNED-DvPuwyCV.js +1 -0
  127. package/static/assets/arc-DRKw7sjs.js +1 -0
  128. package/static/assets/architectureDiagram-ZJ3FMSHR-CaNcxUbC.js +36 -0
  129. package/static/assets/blockDiagram-677ZJIJ3-Demd4AOK.js +132 -0
  130. package/static/assets/c4Diagram-LMCZKHZV-PVKUfc2x.js +10 -0
  131. package/static/assets/channel-C2nVbuwv.js +1 -0
  132. package/static/assets/chunk-2Q5K7J3B-CExf8ww_.js +1 -0
  133. package/static/assets/chunk-32BRIVSS-CFPaoONF.js +1 -0
  134. package/static/assets/chunk-5VM5RSS4-DE2esM67.js +15 -0
  135. package/static/assets/chunk-EX3LRPZG-SON_YdDG.js +231 -0
  136. package/static/assets/chunk-JWPE2WC7-Qxah8LNr.js +1 -0
  137. package/static/assets/chunk-MOJQB5TN-BcWGQV3j.js +88 -0
  138. package/static/assets/chunk-RYQCIY6F-DkDj-OR5.js +1 -0
  139. package/static/assets/chunk-V7JOEXUC-BlI1Mrah.js +206 -0
  140. package/static/assets/chunk-VR4S4FIN-Agf__duj.js +1 -0
  141. package/static/assets/chunk-XXDRQBXY-B5CfAh85.js +1 -0
  142. package/static/assets/classDiagram-OUVF2IWQ-DXJIljsR.js +1 -0
  143. package/static/assets/classDiagram-v2-EOCWNBFH-DXJIljsR.js +1 -0
  144. package/static/assets/cose-bilkent-JH36ORCC-DO0cQkcy.js +1 -0
  145. package/static/assets/cynefin-VYW2F7L2-CfOnsnXc.js +178 -0
  146. package/static/assets/cynefinDiagram-TSTJHNR4-BJ8tULAv.js +62 -0
  147. package/static/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
  148. package/static/assets/dagre-VKFMJZFB-DfjwzHqP.js +4 -0
  149. package/static/assets/defaultLocale-DX6XiGOO.js +1 -0
  150. package/static/assets/diagram-FQU43EPY-CndSOIIM.js +3 -0
  151. package/static/assets/diagram-G47NLZAW-Czf5hN0Z.js +24 -0
  152. package/static/assets/diagram-NH7WQ7WH-COAyojGh.js +24 -0
  153. package/static/assets/diagram-OA4YK3LP-H8PoiN2m.js +30 -0
  154. package/static/assets/diagram-WEI45ONY-DzcaVzjp.js +41 -0
  155. package/static/assets/ebnfDiagram-CCIWWBDH-DPazGYLJ.js +1 -0
  156. package/static/assets/erDiagram-Q63AITRT-Bo-fubgF.js +85 -0
  157. package/static/assets/flowDiagram-23GEKE2U-CSvxUDwh.js +156 -0
  158. package/static/assets/ganttDiagram-NO4QXBWP-DnBveWX6.js +292 -0
  159. package/static/assets/gitGraphDiagram-IHSO6WYX-B3rVL8c-.js +106 -0
  160. package/static/assets/graph-C9eacEi8.js +1 -0
  161. package/static/assets/index-LZSQkLE2.css +41 -0
  162. package/static/assets/index-y7XDSgMG.js +495 -0
  163. package/static/assets/infoDiagram-FWYZ7A6U-CvWV9yy2.js +2 -0
  164. package/static/assets/init-Gi6I4Gst.js +1 -0
  165. package/static/assets/ishikawaDiagram-FXEZZL3T-DF28a1N6.js +70 -0
  166. package/static/assets/journeyDiagram-5HDEW3XC-CB6CugYk.js +139 -0
  167. package/static/assets/kanban-definition-HUTT4EX6-ResSLF6d.js +89 -0
  168. package/static/assets/katex-C5jXJg4s.js +257 -0
  169. package/static/assets/layout-DEXfKzaS.js +1 -0
  170. package/static/assets/linear-CLO--ryk.js +1 -0
  171. package/static/assets/map-Czzmt4hB.js +1 -0
  172. package/static/assets/mindmap-definition-LN4V7U3C-BvW3EbxX.js +96 -0
  173. package/static/assets/ordinal-Cboi1Yqb.js +1 -0
  174. package/static/assets/pegDiagram-2B236MQR-BHCgqrrM.js +1 -0
  175. package/static/assets/pieDiagram-ENE6RG2P-DVmCQ5FA.js +39 -0
  176. package/static/assets/quadrantDiagram-ABIIQ3AL-B3e5KR52.js +7 -0
  177. package/static/assets/railroadDiagram-RFXS5EU6-Csv5ysLc.js +1 -0
  178. package/static/assets/requirementDiagram-TGXJPOKE-DOMVzvnB.js +84 -0
  179. package/static/assets/sankeyDiagram-HTMAVEWB-B1dcTOvy.js +40 -0
  180. package/static/assets/sequenceDiagram-DBY2YBRQ-BY414yeO.js +162 -0
  181. package/static/assets/sizeCapture-X5ZJPWSS-CuJfrfBN.js +1 -0
  182. package/static/assets/stateDiagram-2N3HPSRC-FX4rJkzV.js +1 -0
  183. package/static/assets/stateDiagram-v2-6OUMAXLB-BVufbO_H.js +1 -0
  184. package/static/assets/swimlanes-5IMT3BWC-Sfy58mmv.js +2 -0
  185. package/static/assets/swimlanesDiagram-G3AALYLV-wDCDw08H.js +8 -0
  186. package/static/assets/timeline-definition-FHXFAJF6-CmV7by8p.js +120 -0
  187. package/static/assets/vennDiagram-L72KCM5P-FqIyFZFt.js +34 -0
  188. package/static/assets/wardleyDiagram-EHGQE667-BZ06O45i.js +78 -0
  189. package/static/assets/xychartDiagram-FW5EYKEG-BOkffR06.js +7 -0
  190. package/static/index.html +24 -0
@@ -0,0 +1,366 @@
1
+ # Packaging Patterns — Multi-Release Fat JAR with Maven
2
+
3
+ This reference describes the canonical Maven configuration the generated spec must
4
+ emit. The goal: a single fat JAR that is also a Multi-Release JAR (MR-JAR), runs on
5
+ JDK 8 → 21 from one artifact, and bundles OkHttp + transitives under a relocated
6
+ package so it can be dropped on any classpath without conflicting with the consumer's
7
+ own dependencies.
8
+
9
+ The two non-trivial parts are:
10
+
11
+ 1. Compiling the JDK 11 overlay sources to a separate directory and packaging them
12
+ under `META-INF/versions/11/` of the JAR.
13
+ 2. Preserving `Multi-Release: true` in the manifest after `maven-shade-plugin` runs —
14
+ Shade rewrites the JAR and silently drops manifest entries unless explicitly told
15
+ to keep them.
16
+
17
+ ---
18
+
19
+ ## Source Directory Layout
20
+
21
+ ```
22
+ src/
23
+ ├── main/
24
+ │ ├── java/ ← JDK 8 baseline. ALL public API lives here.
25
+ │ ├── java11/ ← JDK 11 overlay. Same package paths only. NO new public types.
26
+ │ └── resources/
27
+ └── test/
28
+ └── java/
29
+ ```
30
+
31
+ > **Rule:** Every class under `src/main/java11` MUST also exist in `src/main/java`
32
+ > with an identical public signature. Overlays are performance/feature alternatives,
33
+ > NOT new APIs.
34
+
35
+ ---
36
+
37
+ ## Complete `pom.xml`
38
+
39
+ ```xml
40
+ <?xml version="1.0" encoding="UTF-8"?>
41
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
42
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
43
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
+
45
+ <modelVersion>4.0.0</modelVersion>
46
+
47
+ <groupId>com.bestinet.urp</groupId>
48
+ <artifactId>{{ARTIFACT_ID}}</artifactId>
49
+ <version>{{VERSION}}</version>
50
+ <packaging>jar</packaging>
51
+
52
+ <name>{{APPLICATION_NAME}}</name>
53
+ <description>{{APP_DESCRIPTION}}</description>
54
+
55
+ <properties>
56
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
57
+ <maven.compiler.release>8</maven.compiler.release>
58
+ <okhttp.version>4.12.0</okhttp.version>
59
+ <junit.version>5.10.2</junit.version>
60
+ <assertj.version>3.26.3</assertj.version>
61
+ <shade.relocation.base>{{BASE_PACKAGE}}.shaded</shade.relocation.base>
62
+ </properties>
63
+
64
+ <dependencies>
65
+ <!-- Sole runtime third-party dependency -->
66
+ <dependency>
67
+ <groupId>com.squareup.okhttp3</groupId>
68
+ <artifactId>okhttp</artifactId>
69
+ <version>${okhttp.version}</version>
70
+ </dependency>
71
+
72
+ <!-- SLF4J facade — provided, NEVER bundled. Optional: include only if Logging = SLF4J facade -->
73
+ <dependency>
74
+ <groupId>org.slf4j</groupId>
75
+ <artifactId>slf4j-api</artifactId>
76
+ <version>2.0.13</version>
77
+ <scope>provided</scope>
78
+ </dependency>
79
+
80
+ <!-- Test scope -->
81
+ <dependency>
82
+ <groupId>org.junit.jupiter</groupId>
83
+ <artifactId>junit-jupiter</artifactId>
84
+ <version>${junit.version}</version>
85
+ <scope>test</scope>
86
+ </dependency>
87
+ <dependency>
88
+ <groupId>org.assertj</groupId>
89
+ <artifactId>assertj-core</artifactId>
90
+ <version>${assertj.version}</version>
91
+ <scope>test</scope>
92
+ </dependency>
93
+ <dependency>
94
+ <groupId>com.squareup.okhttp3</groupId>
95
+ <artifactId>mockwebserver</artifactId>
96
+ <version>${okhttp.version}</version>
97
+ <scope>test</scope>
98
+ </dependency>
99
+ </dependencies>
100
+
101
+ <build>
102
+ <finalName>${project.artifactId}-${project.version}</finalName>
103
+
104
+ <plugins>
105
+
106
+ <!-- 1. Compile JDK 8 baseline AND JDK 11 overlay separately -->
107
+ <plugin>
108
+ <groupId>org.apache.maven.plugins</groupId>
109
+ <artifactId>maven-compiler-plugin</artifactId>
110
+ <version>3.13.0</version>
111
+ <executions>
112
+ <!-- Default: compile src/main/java with --release 8 -->
113
+ <execution>
114
+ <id>default-compile</id>
115
+ <configuration>
116
+ <release>8</release>
117
+ </configuration>
118
+ </execution>
119
+ <!-- Overlay: compile src/main/java11 with --release 11 -->
120
+ <execution>
121
+ <id>compile-java11</id>
122
+ <phase>compile</phase>
123
+ <goals><goal>compile</goal></goals>
124
+ <configuration>
125
+ <release>11</release>
126
+ <compileSourceRoots>
127
+ <root>${project.basedir}/src/main/java11</root>
128
+ </compileSourceRoots>
129
+ <outputDirectory>${project.build.directory}/classes-java11</outputDirectory>
130
+ <multiReleaseOutput>true</multiReleaseOutput>
131
+ </configuration>
132
+ </execution>
133
+ </executions>
134
+ </plugin>
135
+
136
+ <!-- 2. Build the (thin) Multi-Release JAR -->
137
+ <plugin>
138
+ <groupId>org.apache.maven.plugins</groupId>
139
+ <artifactId>maven-jar-plugin</artifactId>
140
+ <version>3.4.2</version>
141
+ <configuration>
142
+ <archive>
143
+ <manifestEntries>
144
+ <Multi-Release>true</Multi-Release>
145
+ <!-- If a Diagnostic main is included, set Main-Class here -->
146
+ <!-- <Main-Class>{{BASE_PACKAGE}}.cli.Diagnose</Main-Class> -->
147
+ </manifestEntries>
148
+ </archive>
149
+ <!-- Copy JDK 11 overlay classes into META-INF/versions/11/ -->
150
+ <includes>
151
+ <include>**</include>
152
+ </includes>
153
+ </configuration>
154
+ <executions>
155
+ <execution>
156
+ <id>default-jar</id>
157
+ <phase>package</phase>
158
+ <goals><goal>jar</goal></goals>
159
+ </execution>
160
+ </executions>
161
+ </plugin>
162
+
163
+ <!-- 3. Copy java11 overlay classes into META-INF/versions/11 before packaging -->
164
+ <plugin>
165
+ <groupId>org.apache.maven.plugins</groupId>
166
+ <artifactId>maven-resources-plugin</artifactId>
167
+ <version>3.3.1</version>
168
+ <executions>
169
+ <execution>
170
+ <id>copy-java11-overlay</id>
171
+ <phase>prepare-package</phase>
172
+ <goals><goal>copy-resources</goal></goals>
173
+ <configuration>
174
+ <outputDirectory>${project.build.outputDirectory}/META-INF/versions/11</outputDirectory>
175
+ <resources>
176
+ <resource>
177
+ <directory>${project.build.directory}/classes-java11</directory>
178
+ </resource>
179
+ </resources>
180
+ </configuration>
181
+ </execution>
182
+ </executions>
183
+ </plugin>
184
+
185
+ <!-- 4. Shade plugin — produce the fat JAR, relocate transitives, keep MR manifest -->
186
+ <plugin>
187
+ <groupId>org.apache.maven.plugins</groupId>
188
+ <artifactId>maven-shade-plugin</artifactId>
189
+ <version>3.6.0</version>
190
+ <executions>
191
+ <execution>
192
+ <phase>package</phase>
193
+ <goals><goal>shade</goal></goals>
194
+ <configuration>
195
+ <createDependencyReducedPom>true</createDependencyReducedPom>
196
+ <shadedArtifactAttached>false</shadedArtifactAttached>
197
+ <minimizeJar>false</minimizeJar>
198
+
199
+ <relocations>
200
+ <relocation>
201
+ <pattern>okhttp3</pattern>
202
+ <shadedPattern>${shade.relocation.base}.okhttp3</shadedPattern>
203
+ </relocation>
204
+ <relocation>
205
+ <pattern>okio</pattern>
206
+ <shadedPattern>${shade.relocation.base}.okio</shadedPattern>
207
+ </relocation>
208
+ <relocation>
209
+ <pattern>kotlin</pattern>
210
+ <shadedPattern>${shade.relocation.base}.kotlin</shadedPattern>
211
+ </relocation>
212
+ </relocations>
213
+
214
+ <filters>
215
+ <filter>
216
+ <artifact>*:*</artifact>
217
+ <excludes>
218
+ <exclude>META-INF/*.SF</exclude>
219
+ <exclude>META-INF/*.DSA</exclude>
220
+ <exclude>META-INF/*.RSA</exclude>
221
+ <exclude>META-INF/MANIFEST.MF</exclude>
222
+ <exclude>module-info.class</exclude>
223
+ </excludes>
224
+ </filter>
225
+ </filters>
226
+
227
+ <transformers>
228
+ <!-- Preserve Multi-Release: true and other manifest entries -->
229
+ <transformer
230
+ implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
231
+ <manifestEntries>
232
+ <Multi-Release>true</Multi-Release>
233
+ <!-- <Main-Class>{{BASE_PACKAGE}}.cli.Diagnose</Main-Class> -->
234
+ <Implementation-Title>{{APPLICATION_NAME}}</Implementation-Title>
235
+ <Implementation-Version>${project.version}</Implementation-Version>
236
+ </manifestEntries>
237
+ </transformer>
238
+ <!-- Merge service files (only if any SPI is exposed) -->
239
+ <transformer
240
+ implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
241
+ </transformers>
242
+ </configuration>
243
+ </execution>
244
+ </executions>
245
+ </plugin>
246
+
247
+ <!-- 5. Sources & Javadoc JARs -->
248
+ <plugin>
249
+ <groupId>org.apache.maven.plugins</groupId>
250
+ <artifactId>maven-source-plugin</artifactId>
251
+ <version>3.3.1</version>
252
+ <executions>
253
+ <execution>
254
+ <id>attach-sources</id>
255
+ <goals><goal>jar-no-fork</goal></goals>
256
+ </execution>
257
+ </executions>
258
+ </plugin>
259
+ <plugin>
260
+ <groupId>org.apache.maven.plugins</groupId>
261
+ <artifactId>maven-javadoc-plugin</artifactId>
262
+ <version>3.10.0</version>
263
+ <configuration>
264
+ <source>8</source>
265
+ <doclint>none</doclint>
266
+ </configuration>
267
+ <executions>
268
+ <execution>
269
+ <id>attach-javadocs</id>
270
+ <goals><goal>jar</goal></goals>
271
+ </execution>
272
+ </executions>
273
+ </plugin>
274
+
275
+ <!-- 6. Surefire — JUnit 5 -->
276
+ <plugin>
277
+ <groupId>org.apache.maven.plugins</groupId>
278
+ <artifactId>maven-surefire-plugin</artifactId>
279
+ <version>3.5.0</version>
280
+ </plugin>
281
+
282
+ </plugins>
283
+ </build>
284
+ </project>
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Why This Works
290
+
291
+ ### Multi-Release JAR layout
292
+
293
+ The JVM reads `Multi-Release: true` from `META-INF/MANIFEST.MF`. When running on JDK
294
+ N (N >= 9), the classloader checks `META-INF/versions/N/`, then `META-INF/versions/N-1/`,
295
+ … down to the JAR root. The first match wins. Classes that exist only at the root are
296
+ the JDK 8 baseline.
297
+
298
+ By compiling `src/main/java11` to `target/classes-java11` and copying that tree under
299
+ `target/classes/META-INF/versions/11/`, the resulting JAR has the right shape.
300
+
301
+ ### Shade plugin & MR-JAR
302
+
303
+ Shade rewrites the JAR — and historically loses MR semantics unless told to keep them.
304
+ The configuration above:
305
+
306
+ - Excludes the source artifacts' `META-INF/MANIFEST.MF` (so the consumer's manifest
307
+ comes from the project, not the dependencies)
308
+ - Uses `ManifestResourceTransformer` with `<Multi-Release>true</Multi-Release>`
309
+ - Relocates OkHttp/Okio/Kotlin under `{{BASE_PACKAGE}}.shaded.*` to prevent classpath
310
+ collisions (e.g., the consumer might use a different OkHttp version)
311
+ - `module-info.class` is excluded because we're a classpath JAR, not a JPMS module
312
+ (relocation breaks `module-info.class` in any case)
313
+
314
+ ### Why `<scope>provided</scope>` for SLF4J
315
+
316
+ The SLF4J facade is the de-facto standard for logging in Java libraries. Including it
317
+ as `provided` means:
318
+
319
+ - It's available at compile time
320
+ - It's NOT shaded into the fat JAR
321
+ - The consumer's classpath supplies the binding
322
+
323
+ If the consumer has no SLF4J binding at all, SLF4J's no-op binding kicks in silently —
324
+ no errors, no output. This is the documented SLF4J behaviour and is the right choice
325
+ for an SDK library.
326
+
327
+ ---
328
+
329
+ ## Verification After `mvn package`
330
+
331
+ ```
332
+ mvn clean package
333
+
334
+ # 1. Manifest contains Multi-Release: true
335
+ unzip -p target/{{ARTIFACT_ID}}-{{VERSION}}.jar META-INF/MANIFEST.MF | grep -i multi-release
336
+
337
+ # 2. JDK 11 overlay classes are present
338
+ jar tf target/{{ARTIFACT_ID}}-{{VERSION}}.jar | grep "^META-INF/versions/11/" | head
339
+
340
+ # 3. OkHttp is relocated under {{BASE_PACKAGE}}/shaded/...
341
+ jar tf target/{{ARTIFACT_ID}}-{{VERSION}}.jar | grep "^{{BASE_PACKAGE_SLASHED}}/shaded/okhttp3/" | head
342
+
343
+ # 4. NO unrelocated transitives at JAR root
344
+ jar tf target/{{ARTIFACT_ID}}-{{VERSION}}.jar | grep -E "^okhttp3/|^okio/|^kotlin/" || echo "OK: none"
345
+
346
+ # 5. (Optional) Run on each JDK if Diagnose is included
347
+ JAVA_HOME=/path/to/jdk-8 java -jar target/{{ARTIFACT_ID}}-{{VERSION}}.jar
348
+ JAVA_HOME=/path/to/jdk-11 java -jar target/{{ARTIFACT_ID}}-{{VERSION}}.jar
349
+ JAVA_HOME=/path/to/jdk-17 java -jar target/{{ARTIFACT_ID}}-{{VERSION}}.jar
350
+ JAVA_HOME=/path/to/jdk-21 java -jar target/{{ARTIFACT_ID}}-{{VERSION}}.jar
351
+ ```
352
+
353
+ All five checks must pass before the artifact is considered release-ready.
354
+
355
+ ---
356
+
357
+ ## Common Pitfalls
358
+
359
+ | Pitfall | Symptom | Fix |
360
+ |---------|---------|-----|
361
+ | `<release>` left at default | Bytecode targets the JDK that ran Maven | Always set `maven.compiler.release` AND per-execution `<release>` |
362
+ | Shade drops manifest | `Multi-Release` missing → JDK 11 overlay never used | Use `ManifestResourceTransformer` with the explicit entry |
363
+ | OkHttp not relocated | Consumer's OkHttp version conflicts | Add the `<relocation>` entries above |
364
+ | `module-info.class` left in fat JAR | Module path consumers fail to load | Exclude `module-info.class` in the Shade `<filters>` |
365
+ | JDK 11 overlay introduces a new public type | API breaks on JDK 8 (NoClassDefFoundError) | Overlays MUST mirror baseline signatures |
366
+ | `merged-services` not transformed | SPI resolution breaks | Add `ServicesResourceTransformer` (only if SPI exposed) |