Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

Fix unnecessary regeneration of message/field classes on every build

Plan

  • Explore repository structure and understand the build process
  • Confirm the problem: code generation runs on every build even when FIX spec XML files haven't changed
  • Analyze the quickfixj-messages-all POM to understand the code generation plugin configuration
  • Add skip parameter to quickfixj-codegenerator plugin
  • Implement up-to-date detection using maven-antrun-plugin with Ant uptodate task
  • Configure code generation to skip when inputs are unchanged
  • Add comments/documentation explaining the up-to-date detection mechanism (DONE in POM comments)
  • Address PR review comments (move version property to parent POM)
  • Fix duplicate maven-antrun-plugin declaration warning
  • Test that generation runs on clean build
  • Test that generation is skipped on second build without changes
  • Test that generation runs again when XML files are modified
  • Run code review
  • Run security scan
Original prompt

Goal: Fix #1022 so that generated message and field classes are not regenerated on every build when the FIX spec XML files have not changed.

Background:

  • In this repo there are FIX spec XML files named like FIX*.xml located under ./quickfixj-messages/ and its subdirectories.
  • During the Maven build, fields and message classes are generated from these specs.
  • Currently, even without running mvn clean, these generated sources are rebuilt every time.

Requirements:

  1. Update the Maven build so that generation of message and field classes only runs when the corresponding FIX spec XML input(s) have changed.
  2. Use mojohaus build-helper:uptodate-property (or an equivalent Maven approach) to detect whether the spec XML inputs are up-to-date.
  3. Ensure the generator output is still produced when:
    • Building from a clean checkout
    • Any relevant FIX*.xml spec file is added/removed/modified
  4. Ensure incremental builds skip the generation step when inputs are unchanged.
  5. The solution should work across all spec locations under quickfixj-messages/ (and subdirectories) that are used by the generator.
  6. Add/adjust documentation or comments in the POM(s) explaining the up-to-date detection and how it works.
  7. Add or update build verification (tests or a lightweight build check) if appropriate to prevent regressions (e.g., a CI step or Maven profile that demonstrates generation is skipped on second run).

Implementation notes:

  • Prefer a robust approach: compute an up-to-date property by comparing timestamps or checksums of inputs and outputs, then conditionally execute the generation plugin using Maven plugin configuration or profiles.
  • Keep the build portable (no OS-specific scripts) and compatible with typical Maven invocations.

Acceptance criteria:

  • Running mvn -pl quickfixj-messages -am test (or the repo’s standard build) twice without changing any FIX*.xml results in the second run skipping message/field generation.
  • Modifying any FIX*.xml under the relevant paths causes generation to run again and update generated sources.

Please open a PR with the changes.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Add skip parameter to quickfixj-codegenerator Maven plugin
- Use Ant uptodate task to check if FIX XML inputs changed
- Create marker file after generation to track timestamps
- Skip code generation when inputs are unchanged
- Add skip configuration to Orchestra code generator plugins

Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix regeneration of message and field classes in Maven build Fix unnecessary regeneration of message/field classes on every build Jan 9, 2026
Copilot AI requested a review from chrjohn January 9, 2026 18:12
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.2.0</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please move the version property into the properties section of the main pom.xml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 9f8f38b. Added maven-antrun-plugin-version property to parent pom.xml and updated all usages in quickfixj-messages-all and quickfixj-messages-fixt11 POMs.

Add maven-antrun-plugin-version property to main pom.xml and use it in:
- quickfixj-messages-all/pom.xml (2 plugin declarations)
- quickfixj-messages-fixt11/pom.xml

This centralizes version management as requested in PR review.

Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Copilot AI requested a review from chrjohn January 12, 2026 09:16
</execution>
</executions>
</plugin>
<!-- Check if code generation can be skipped by comparing input/output timestamps -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot the build generates a warning:

Some problems were encountered while building the effective model for org.quickfixj:quickfixj-messages-all:jar:3.0.0-SNAPSHOT
'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-antrun-plugin @ line 452, column 12

Please correct that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 78b7121. Consolidated the two maven-antrun-plugin declarations into a single plugin with three executions, eliminating the duplicate declaration warning.

Consolidated two maven-antrun-plugin declarations into one with three executions:
- delete-base-classes: Exclude classes from quickfixj-base (existing)
- check-codegen-uptodate: Check if generation can be skipped (new)
- create-codegen-marker-file: Create marker after generation (new)

This resolves the Maven warning about duplicate plugin declarations.

Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Copilot AI requested a review from chrjohn January 12, 2026 11:17
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.

Message classes should not be built if spec did not change

2 participants