Skip to content

Commit e8d678c

Browse files
committed
Merge branch 'gwr0-0-build/untrack-mcp-ui-assets'
Signed-off-by: Badr NASS LAHSEN <badr.nasslahsen@gmail.com>
2 parents 1c81066 + 756aaa5 commit e8d678c

12 files changed

Lines changed: 95 additions & 22111 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,20 @@ jobs:
7979
# pluginManagement version and none of its configuration applies —
8080
# wrong tag name, no autoVersionSubmodules, and release:perform would
8181
# deploy unsigned artifacts that Central rejects.
82+
#
83+
# -Dskip.npm=false is forced for the same reason the profiles are explicit. The MCP
84+
# dashboard assets are build output and are no longer tracked in git, so a release
85+
# that skipped the frontend would publish a jar without the dashboard. release:perform
86+
# builds in its own target/checkout, where a workflow-level path check cannot gate the
87+
# deploy, so pin the property here and let the enforcer rule in
88+
# springdoc-openapi-starter-common-mcp fail the build if the assets are still missing.
8289
- name: Release
8390
run: |
8491
./mvnw $MAVEN_ARGS -Pci,gpg release:prepare release:perform \
8592
-DreleaseVersion='${{ inputs.releaseVersion }}' \
8693
-DdevelopmentVersion='${{ inputs.developmentVersion }}' \
8794
-DdryRun=${{ inputs.dryRun }} \
88-
-Darguments="-DskipTests"
95+
-Darguments="-DskipTests -Dskip.npm=false"
8996
env:
9097
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
9198
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}

‎CONTRIBUTING.adoc‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,29 @@ The project can be built from the root directory with:
130130

131131
On Windows, use `mvnw.cmd install`.
132132

133+
==== The MCP dashboard frontend
134+
135+
`springdoc-openapi-starter-common-mcp` ships a React dashboard. The build runs `npm install` and
136+
`vite build` for it through the
137+
https://github.com/eirslett/frontend-maven-plugin[frontend-maven-plugin], which downloads the Node
138+
version pinned by the `node.version` property in the root `pom.xml`. No local Node installation is
139+
required.
140+
141+
The dashboard is build output: it is generated straight into the module's output directory
142+
(`springdoc-openapi-starter-common-mcp/target/classes/mcp-ui`), it is not tracked by git, and
143+
`./mvnw clean` removes it. The module excludes `mcp-ui/**` from `src/main/resources`, so a copy left
144+
there by a standalone `npm run build` is never packaged.
145+
146+
Passing `-Dskip.npm=true` skips the frontend step and leaves the build directory alone. That means
147+
whatever is already in `target/classes/mcp-ui` — possibly from an earlier build, and possibly older
148+
than the current frontend sources — is packaged as-is, and a `./mvnw clean` build packages no dashboard
149+
at all. In the latter case, with `springdoc.ai.mcp.dashboard-enabled=true`, the dashboard path serves
150+
HTTP 404 for the UI, while `/api/mcp-admin/**` is unaffected.
151+
152+
The release and snapshot builds always build the frontend (`-Pci`, and `-Dskip.npm=false` forced by
153+
the release workflow), so published artifacts always carry a dashboard built from the sources they
154+
were tagged from.
155+
133156
== Cloning the git repository on Windows
134157

135158
Some files in the git repository may exceed the Windows maximum file path (260 characters), depending on where you clone the repository.

‎springdoc-openapi-starter-common-mcp/.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,5 @@ Desktop.ini
146146
######################
147147
# MCP Dashboard
148148
######################
149-
src/main/frontend/node_modules/
149+
src/main/frontend/node_modules/
150+
src/main/resources/mcp-ui/

‎springdoc-openapi-starter-common-mcp/pom.xml‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,34 @@
5151
<fileset>
5252
<directory>src/main/frontend/node_modules</directory>
5353
</fileset>
54+
<!-- Build output that older revisions of this module wrote into the source
55+
tree. Nothing generates it any more, but a stale copy left in a working
56+
copy should not survive a clean. -->
57+
<fileset>
58+
<directory>src/main/resources/mcp-ui</directory>
59+
</fileset>
5460
</filesets>
5561
</configuration>
5662
</plugin>
63+
<!-- The dashboard assets are written by the frontend build straight into
64+
${project.build.outputDirectory}/mcp-ui, which mvn clean removes. Exclude any
65+
copy sitting in the source tree, so a leftover from an earlier build (or from a
66+
standalone npm run build) can never be packaged in place of freshly built
67+
assets. -->
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-resources-plugin</artifactId>
71+
<executions>
72+
<execution>
73+
<id>default-resources</id>
74+
<configuration>
75+
<excludes>
76+
<exclude>mcp-ui/**</exclude>
77+
</excludes>
78+
</configuration>
79+
</execution>
80+
</executions>
81+
</plugin>
5782
<plugin>
5883
<groupId>com.github.eirslett</groupId>
5984
<artifactId>frontend-maven-plugin</artifactId>
@@ -88,6 +113,38 @@
88113
</goals>
89114
<configuration>
90115
<arguments>run build</arguments>
116+
<environmentVariables>
117+
<MCP_UI_OUT_DIR>${project.build.outputDirectory}/mcp-ui</MCP_UI_OUT_DIR>
118+
</environmentVariables>
119+
</configuration>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
<!-- The dashboard assets are generated by the frontend plugin above and are not
124+
tracked by git, so a build that skips the frontend step would silently package
125+
a jar without the UI. Fail such a build instead of shipping it. This runs from
126+
the project itself, so it also covers release:perform, which builds in its own
127+
target/checkout where a workflow-level path check would not apply. -->
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-enforcer-plugin</artifactId>
131+
<executions>
132+
<execution>
133+
<id>require-mcp-dashboard-assets</id>
134+
<phase>process-classes</phase>
135+
<goals>
136+
<goal>enforce</goal>
137+
</goals>
138+
<configuration>
139+
<skip>${skip.npm}</skip>
140+
<rules>
141+
<requireFilesExist>
142+
<message>The MCP dashboard assets are missing from ${project.build.outputDirectory}/mcp-ui, so the packaged jar would ship without the UI. They are generated by frontend-maven-plugin; build without -Dskip.npm=true.</message>
143+
<files>
144+
<file>${project.build.outputDirectory}/mcp-ui/index.html</file>
145+
</files>
146+
</requireFilesExist>
147+
</rules>
91148
</configuration>
92149
</execution>
93150
</executions>

‎springdoc-openapi-starter-common-mcp/src/main/frontend/vite.config.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export default defineConfig({
1111
},
1212
},
1313
build: {
14-
outDir: '../resources/mcp-ui',
14+
// The Maven build points this at the module output directory (target/classes/mcp-ui) so
15+
// that the generated dashboard lives under target/, where mvn clean removes it. A
16+
// standalone build keeps writing next to the sources; those copies are not tracked, and
17+
// the module excludes them from the jar, which only ever packages what Maven produced.
18+
outDir: process.env.MCP_UI_OUT_DIR ?? '../resources/mcp-ui',
1519
emptyOutDir: true,
1620
},
1721
server: {
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)