Sometimes gradle 7.1 is not generating java class file


We have started using gradle (7.1 version) since 3 months in our project.
We have 3 multimodule gradle projects. All these 3 projects put together generates around 300 jar files.
Sometimes we observed, gradle is not generating class file.

This is a simple class having @service annotation and we are using springframework.
I deleted the jar via gradle clean task. Again I generated jar via gradle build, this time it generated class file. It is really weird. Need help if anyone already facing this issue and any other settings or configurations we are missing here.

See below code snippet for your reference.

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import javax.annotation.PostConstruct;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

public class BackgroundProcessResultCacheServiceImpl implements BackgroundProcessResultCacheService, PSSCacheListener {
private static final Log log = LogFactory.getLog(BackgroundProcessResultCacheServiceImpl.class);