Skip to content

fix: write generated service build artifacts to target instead of sources#2437

Open
mvanhorn wants to merge 3 commits into
TimefoldAI:mainfrom
mvanhorn:fix/2410-generated-files-to-target
Open

fix: write generated service build artifacts to target instead of sources#2437
mvanhorn wants to merge 3 commits into
TimefoldAI:mainfrom
mvanhorn:fix/2410-generated-files-to-target

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

Keep the service build's generated artifacts out of the source tree. The flatten-maven-plugin now writes .flattened-pom.xml under target/ instead of each module basedir, and the generated diagnostic-tools.jar is 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.

  • In service/facade/service-parent/pom.xml the flatten-maven-plugin config now sets outputDirectory to ${project.build.directory} with flattenedPomFilename .flattened-pom.xml, so the flattened pom lands in target/.
  • The timefold-model-enhanced-openapi.json is already written to the build output directory by TimefoldModelDescriptorProcessor (out.getOutputDirectory()), so no producer change was needed.
  • The copy-timefold-diagnostic-tools execution still writes to src/main/jib/timefold because Quarkus container-image-jib only includes files from that fixed directory and it cannot be pointed at target/. To satisfy the "must not be checked into Git" requirement, that jar is git-ignored, and maven-clean-plugin deletes it on clean and at the initialize phase (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.
  • A defensive .gitignore entry backs up all three artifact patterns.

Testing

mvn validate cannot run here because it requires the 999-SNAPSHOT solver 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

mvanhorn added 3 commits June 29, 2026 02:21
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Service: Move generated files jib diagonotic-tools.jar and .flattened-pom.xml and enhanced-openapi.json to the target directory

1 participant