fix: write generated service build artifacts to target instead of sources#2437
Open
mvanhorn wants to merge 3 commits into
Open
fix: write generated service build artifacts to target instead of sources#2437mvanhorn wants to merge 3 commits into
mvanhorn wants to merge 3 commits into
Conversation
…rces Relocate the flatten-maven-plugin output (.flattened-pom.xml) under the module target/ directory so it no longer litters the source tree of models and quickstarts. The diagnostic-tools.jar must remain in src/main/jib because Quarkus container-image-jib only includes files from that fixed directory, so it is kept out of Git via .gitignore instead. Add .gitignore backstops for all three generated artifacts. Fixes TimefoldAI#2410
The diagnostic-tools jar must stay under src/main/jib for Quarkus container-image-jib to include it, so mvn clean (which only wipes target) would otherwise leave a stale copy behind that a later non-enterprise build could ship. Configure maven-clean-plugin to delete it on clean.
Bind maven-clean-plugin to the initialize phase (with excludeDefaultDirectories so target/ is untouched) so the generated jib jar is removed before every build, not only on mvn clean. This prevents a stale enterprise jar from being packaged by a later non-enterprise build that skips the copy and never runs clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keep the service build's generated artifacts out of the source tree. The flatten-maven-plugin now writes
.flattened-pom.xmlundertarget/instead of each module basedir, and the generateddiagnostic-tools.jaris git-ignored and removed at the start of every build so it never gets committed or shipped stale.Why this matters
Issue #2410 reports that
diagnostic-tools.jar,.flattened-pom.xml, and the enhanced OpenAPI spec reappear among the sources on every build and risk being checked into Git across models and quickstarts.service/facade/service-parent/pom.xmltheflatten-maven-pluginconfig now setsoutputDirectoryto${project.build.directory}withflattenedPomFilename.flattened-pom.xml, so the flattened pom lands intarget/.timefold-model-enhanced-openapi.jsonis already written to the build output directory byTimefoldModelDescriptorProcessor(out.getOutputDirectory()), so no producer change was needed.copy-timefold-diagnostic-toolsexecution still writes tosrc/main/jib/timefoldbecause Quarkuscontainer-image-jibonly includes files from that fixed directory and it cannot be pointed attarget/. To satisfy the "must not be checked into Git" requirement, that jar is git-ignored, andmaven-clean-plugindeletes it oncleanand at theinitializephase (before the copy runs) so a stale jar from a previous enterprise build can never be packaged by a later build that skips the copy..gitignoreentry backs up all three artifact patterns.Testing
mvn validatecannot run here because it requires the999-SNAPSHOTsolver artifacts that are not published. Validated that both edited XML files are well-formed and that the flatten-maven-plugin (outputDirectory,flattenedPomFilename) and maven-clean-plugin (filesets,excludeDefaultDirectories) options used are the documented parameters for those plugins.Fixes #2410