How to run custom task after gradle assemble command

Actually I have these lines as part of my build.gradle file (using gradle 7.3.3)

processResources {
    dependsOn "buildAngular"
}


task buildAngular(type: Exec) {
...

my task "buildAngular" runs automaticly on ./gradlew assemble its perfect and exactly what I want. But it runs on ./gradlew test too.

How I can make it run only on ./gradlew assemble?


As already mentioned in my comment on the question:

Since tests require a complete runtime classpath and since processResources produces parts of that classpath, it wouldn’t make sense to not run it when test is run.

If you only want to run buildAngular as part of assemble, then simply make the former a dependency of the latter:

assemble {
    dependsOn 'buildAngular'
}