Java spotless plugin with starred imports

284 Views Asked by At

I have a swagger openapi yml definition to generate apis. But this plugin incorporates unused imprts into the generated files. I could erase most of them by spotless plugin but I can't stop swagger to make starred imports (import javax.validation.constraints.*;) which isn't handled by spotless. Here is my spotless configuration:

            <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <version>2.36.0</version>
            <configuration>
                <java>
                    <includes>
                        <include>target/somewhere/**</include>
                    </includes>
                    <importOrder/>
                    <removeUnusedImports/>
                </java>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>apply</goal>
                    </goals>
                    <phase>compile</phase>
                </execution>
            </executions>
        </plugin>

Do you know any worrkround for this? Either stop swagger starred imports generation or any spotless configuration to delete unused starred imports are welcome.

I am using IntelliJ v2022.3.3

0

There are 0 best solutions below