gantsign / ktlint-maven-plugin

Maven plugin for ktlint the Kotlin linter
http://gantsign.com/ktlint-maven-plugin/
MIT License
61 stars 17 forks source link

How to override source paths properly? #616

Open puskarpeter opened 5 months ago

puskarpeter commented 5 months ago

Currently I am using configuration like this

<plugin>
    <groupId>com.github.gantsign.maven</groupId>
    <artifactId>ktlint-maven-plugin</artifactId>
    <version>3.2.0</version>
    <configuration>
        <experimental>true</experimental>
        <sourceRoots>
            <sourceRoot>${project.basedir}/src/main/kotlin</sourceRoot>
        </sourceRoots>
        <testSourceRoots>
            <sourceRoot>${project.basedir}/src/test/kotlin</sourceRoot>
        </testSourceRoots>
    </configuration>
    <executions>
        <execution>
            <id>check</id>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Since the project contains combined Java and Kotlin sources, but all Kotlin sources are in the folder structure above. This works, but I am getting these warnings:

[WARNING]  Parameter 'sourceRoots' is read-only, must not be used in configuration
[WARNING]  Parameter 'testSourceRoots' is read-only, must not be used in configuration

If it is read-only, I do not know why it works (maybe it is not enforced), but I did not find any simpler solution. Should I configure the plugin in some other way or maybe from the plugin side these parameters should have read-only=false?