Use of the ant plugin for base core22

I had a snapcraft project which uses the ant plugin and was built for core18. Up until earlier this week ant was not available for base core22 but now I am happy to see that it is supported. However my project does not port over seamlessly and I am not sure what I am missing:

main:
   plugin: ant
   source: .
   # In the override-build step the resulting jar files are moved into the install dir
   override-build: |
      ant
      mkdir $SNAPCRAFT_PART_INSTALL/jar
      mv $SNAPCRAFT_PART_BUILD/target/*.jar $SNAPCRAFT_PART_INSTALL/jar

This is the build error I get:

root@snapcraft-ubuntu-22:/home/ubuntu/GITHUB/epi-logstream# snapcraft --destructive-mode Environment validation failed for part ‘main’: ‘ant’ not found and part ‘main’ does not depend on a part named ‘ant-deps’ that would satisfy the dependency.
Full execution log: ‘/root/.local/state/snapcraft/log/snapcraft-20231103-121947.478748.log’

You need to add the ant related packages in build-packages

Just wondering why I would need to add the packages in build-packages if I already stated I am using the ant plugin in the plugin: section? I am comparing to what was required for the core 18 builds.

in core22, plugin means the way that your app will be installed. It doesn’t mean that it’ll also install all the needed packages automatically. Just like for meson plugin, you’ll need to add meson as build package