Skip to content

gha_build.sh ignores failures of the archetype's own mvn install #1715

Open

Description

@ckawl

In gha_build.sh, the archetype function runs mvn -q clean install in the archetype module but doesn't check its exit code. The next step, mvn archetype:generate -DarchetypeCatalog=local, then generates from whatever version of the archetype is in the local catalog.

So when the archetype's integration test fails:

  • On a clean machine, which is CI today since setup-java has no Maven cache, nothing is in the local catalog and generate fails with "The desired archetype does not exist". The job goes red, but the error points at the wrong step.
  • On a machine that has installed an older archetype before (any dev machine, or CI if Maven caching is turned on later), generate quietly uses the old archetype and the run passes. The new archetype is never tested.

Releases aren't affected: release.yml runs mvn release:prepare/perform over the full reactor, which runs the archetype integration tests and stops on failure.

This came up in #1714. The springboot4 archetype's integration test failed with NoClassDefFoundError for JsonApplyView, and a local gha_build.sh run still reported success because it generated from a cached 3.0.3-SNAPSHOT archetype.

Suggested fix: check the exit code after the archetype install, like the other steps do.

cd ${WORKING_DIR}/${ARCHETYPE_NAME} && mvn -q clean install
if [[ "$?" -ne 0 ]]; then
    exit 1
fi

Passing -DarchetypeVersion with the project version to archetype:generate would also stop it from falling back to an older archetype.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions