|
51 | 51 | <fileset> |
52 | 52 | <directory>src/main/frontend/node_modules</directory> |
53 | 53 | </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> |
54 | 60 | </filesets> |
55 | 61 | </configuration> |
56 | 62 | </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> |
57 | 82 | <plugin> |
58 | 83 | <groupId>com.github.eirslett</groupId> |
59 | 84 | <artifactId>frontend-maven-plugin</artifactId> |
|
88 | 113 | </goals> |
89 | 114 | <configuration> |
90 | 115 | <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> |
91 | 148 | </configuration> |
92 | 149 | </execution> |
93 | 150 | </executions> |
|
0 commit comments