Gradlew checkstyleMain command not using right directory

Viewed 70

I'm trying to run ./gradlew checkstyleMain on my project, and I keep getting this error

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':checkstyleMain'.
> Unable to create Root Module

when I run it with --stacktrace, I get

Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Unable to find: .checks/checkstyle_suppressions.xml
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:477)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:198)
        at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.createRootModule(CheckstyleAntTask.java:412)
        ... 140 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to find: .checks/checkstyle_suppressions.xml
        at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:279)
        at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:233)
        at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:220)
        at com.puppycrawl.tools.checkstyle.filters.SuppressionFilter.finishLocalSetup(SuppressionFilter.java:81)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:194)
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:472)
        ... 142 more
Caused by: java.io.FileNotFoundException: /Users/Matthew.Hall/.gradle/daemon/7.4.2/.checks/checkstyle_suppressions.xml (No such file or directory)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:653)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:150)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
        at com.puppycrawl.tools.checkstyle.XmlLoader.parseInputSource(XmlLoader.java:84)
        at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:275)
        ... 147 more

I've checked, and the file is in the my in my .checks folder in my project, however that last "caused by" makes it look like its checking a folder it shouldn't be.

I'm able to work around it by copying my .checks folder from the project into /Users/Matthew.Hall/.gradle/daemon/7.4.2/ but I shouldn't have to do that.

How can I fix this? (Can't figure out how to get it to check in my project folder instead of .gradle/daemon/7.4.2).

0 Answers
Related