jshiell / checkstyle-idea

CheckStyle plug-in for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/1065-checkstyle-idea
Other
887 stars 161 forks source link

"Cannot find packaged artefact" error after upgrading to version 5.93.1 #646

Closed cms04 closed 2 months ago

cms04 commented 2 months ago

After the update to version 5.93.1, I get the following error for every scan:

The scan failed due to an exception: Couldn't create Checker from Own Checkstyle
Root cause: Cannot find packaged artefact: /Users/<...>/Library/Application Support/JetBrains/IdeaIC2024.1/plugins/CheckStyle-IDEA/checkstyle/lib/commons-text-1.3.jar
org.infernus.idea.checkstyle.exception.CheckStylePluginException: Cannot find packaged artefact: /Users/<...>/Library/Application Support/JetBrains/IdeaIC2024.1/plugins/CheckStyle-IDEA/checkstyle/lib/commons-text-1.3.jar
    at org.infernus.idea.checkstyle.CheckstyleClassLoaderContainer.baseClasspathUrlsForPackagedPlugin(CheckstyleClassLoaderContainer.java:129)  
    at org.infernus.idea.checkstyle.CheckstyleClassLoaderContainer.buildClassLoader(CheckstyleClassLoaderContainer.java:102)  
    at org.infernus.idea.checkstyle.CheckstyleClassLoaderContainer. (CheckstyleClassLoaderContainer.java:76) 
    at org.infernus.idea.checkstyle.CheckstyleProjectService$1.call(CheckstyleProjectService.java:78) 
    at org.infernus.idea.checkstyle.CheckstyleProjectService$1.call(CheckstyleProjectService.java:71) 
    at org.infernus.idea.checkstyle.CheckstyleProjectService.checkstyleClassLoaderContainer(CheckstyleProjectService.java:134) 
    at org.infernus.idea.checkstyle.CheckstyleProjectService.underlyingClassLoader(CheckstyleProjectService.java:123) 
    at org.infernus.idea.checkstyle.checker.CheckerFactory.createChecker(CheckerFactory.java:135) 
    at org.infernus.idea.checkstyle.checker.CheckerFactory.getOrCreateCachedChecker(CheckerFactory.java:82) 
    at org.infernus.idea.checkstyle.checker.CheckerFactory.checker(CheckerFactory.java:63) 
    at org.infernus.idea.checkstyle.CheckStyleInspection.lambda$inspectFile$3(CheckStyleInspection.java:133) 
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) 
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) 
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) 
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) 
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) 
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) 
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) 
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) 
    at org.infernus.idea.checkstyle.CheckStyleInspection.inspectFile(CheckStyleInspection.java:141) 
    at org.infernus.idea.checkstyle.CheckStyleInspection.lambda$checkFile$0(CheckStyleInspection.java:85) 
    at com.intellij.openapi.application.impl.RwLockHolder$executeOnPooledThread$2.call(RwLockHolder.kt:182) 
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702) 
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699) 
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) 
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699) 
    at java.base/java.lang.Thread.run(Thread.java:840) 

IntelliJ about:

IntelliJ IDEA 2024.1.4 (Community Edition)
Build #IC-241.18034.62, built on June 20, 2024
Runtime version: 17.0.11+1-b1207.24 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.6.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 10
Metal Rendering is ON
Non-Bundled Plugins:
  Lombook Plugin (241.18034.62)
  CheckStyle-IDEA (5.93.1)
  Docker (241.18034.82)
Kotlin: 241.18034.62-IJ

The problem seems similar to #605 , but reinstalling the whole plugin didn't solve the problem in this case.

jshiell commented 2 months ago

Thanks for the report. I switched to the new JetBrains Gradle plugin for this release, which has a lot of breaking changes, so I presume it’s a side-effect of this.

I’ve pulled the new version until I can get the time to debug this, sorry for all the hassle.

I’m also on Mac but using Community 2024.2 - so I wonder if there’s something significant there, given the IDEA major version is shown in the erroring path.

cms04 commented 2 months ago

Yes, I just installed version 2024.2 and now the error is gone. So there must be a breaking change in the IntelliJ APIs.

But with 2024.2 I had some issues with massive CPU usage (not related to the Checkstyle plugin, but to IntelliJ itself), so I downgraded back to version 2024.1. I continue to monitor the CPU usage, but if it continues to be a problem, I will have to downgrade again.

jshiell commented 2 months ago

Thanks, that’s a useful data point. I’ll certainly aim to get it working on 2024.1!

is-ivanov commented 2 months ago

I have the same problem (but version 5.93.0) and another library

The scan failed due to an exception: Couldn't create Checker from RPM-checkstyle Root cause: Cannot find packaged artefact: C:\Users...\AppData\Roaming\JetBrains\IntelliJIdea2024.2\plugins\CheckStyle-IDEA\checkstyle\lib\httpclient5-5.1.3.jar org.infernus.idea.checkstyle.exception.CheckStylePluginException: Cannot find packaged artefact: C:\Users...\AppData\Roaming\JetBrains\IntelliJIdea2024.2\plugins\CheckStyle-IDEA\checkstyle\lib\httpclient5-5.1.3.jar

jshiell commented 2 months ago

5.93.0 was also built with the new Gradle plugin, so I'd expect it to show the same problems. Both 5.93.0 and 5.93.1 should have been removed from the plugin repo now.

@is-ivanov to help with tracing this, could you please tell me which version of IDEA you're using, and on which platform? Thank you

is-ivanov commented 2 months ago

IntelliJ IDEA 2024.2.0.1 (Ultimate Edition) Build #IU-242.20224.387, built on August 13, 2024 Windows 11

jshiell commented 2 months ago

I'm having problems reproducing this - 2024.1 is working fine in my testing, with both an upgrade and a clean plugin install. The directory structure appears correct as well. The only difference I'm aware of is that I'm install the artefact from disc (as, of course, it's no longer on the JB plugin repo).

~If able, could you please give me a file tree of the ~/Library/Application Support/JetBrains/IdeaIC2024.1/plugins/checkstyle-idea directory (or Win equivalent), e.g. (sorry, no idea of the Windows version of this, although it'd probably work in WSL)~ - EDIT: no need, see below

cd ~/Library/Application Support/JetBrains/IdeaIC2024.1/plugins/checkstyle-idea
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'

What I'd expect, for the record:

.
|____checkstyle
| |____classes
| | |____org
| | | |____infernus
| | | | |____idea
| | | | | |____checkstyle
| | | | | | |____service
| | | | | | | |____cmd
| | | | | | | | |____OpDestroyChecker.class
| | | | | | | | |____OpScan.class
| | | | | | | | |____CheckstyleBridge.class
| | | | | | | | |____OpLoadConfiguration.class
| | | | | | | | |____CheckstyleCommand.class
| | | | | | | | |____OpPeruseConfiguration.class
| | | | | | | | |____OpCreateChecker.class
| | | | | | | | |____OpLoadConfiguration$ConfigurationLoaderWrapper.class
| | | | | | | |____RulesContainer$ContentRulesContainer.class
| | | | | | | |____CheckStyleAuditListener$1.class
| | | | | | | |____ExceptionWrapper.class
| | | | | | | |____RulesContainer$ConfigurationLocationRulesContainer.class
| | | | | | | |____IgnoringResolver.class
| | | | | | | |____CheckStyleAuditListener.class
| | | | | | | |____Configurations.class
| | | | | | | |____CheckstyleActionsImpl.class
| | | | | | | |____SimpleResolver.class
| | | | | | | |____RulesContainer$VirtualFileRulesContainer.class
| | | | | | | |____RulesContainer.class
| | | | | | | |____entities
| | | | | | | | |____CheckerWithConfig.class
| | | | | | | | |____CsConfigObject.class
| | | | | | | | |____HasChecker.class
| | | | | | | | |____HasCsConfig.class
| | |____META-INF
| | | |____plugin.xml
| |____lib
| | |____checkstyle-10.15.0.jar
| | |____picocli-4.7.6.jar
| | |____guava-33.0.0-jre.jar
| | |____plexus-component-annotations-2.1.0.jar
| | |____xmlresolver-5.1.1-data.jar
| | |____checkstyle-10.8.1.jar
| | |____httpcore-4.4.14.jar
| | |____picocli-4.7.5.jar
| | |____checkstyle-10.17.0.jar
| | |____reflections-0.9.12.jar
| | |____doxia-logging-api-1.12.0.jar
| | |____checkstyle-10.13.0.jar
| | |____Saxon-HE-11.4.jar
| | |____slf4j-api-1.7.32.jar
| | |____checker-qual-3.12.0.jar
| | |____javassist-3.28.0-GA.jar
| | |____plexus-utils-3.3.0.jar
| | |____error_prone_annotations-2.11.0.jar
| | |____xmlresolver-4.6.0-data.jar
| | |____checkstyle-10.14.2.jar
| | |____checkstyle-10.16.0.jar
| | |____xmlresolver-5.2.2-data.jar
| | |____guava-33.1.0-jre.jar
| | |____reflections-0.10.2.jar
| | |____doxia-core-1.12.0.jar
| | |____checkstyle-10.9.3.jar
| | |____checkstyle-10.12.7.jar
| | |____Saxon-HE-10.6.jar
| | |____checkstyle-9.1.jar
| | |____Saxon-HE-12.4.jar
| | |____failureaccess-1.0.1.jar
| | |____checkstyle-10.10.0.jar
| | |____plexus-container-default-2.1.0.jar
| | |____picocli-4.6.3.jar
| | |____error_prone_annotations-2.7.1.jar
| | |____failureaccess-1.0.2.jar
| | |____checkstyle-9.3.jar
| | |____plexus-classworlds-2.6.0.jar
| | |____error_prone_annotations-2.23.0.jar
| | |____checker-qual-3.43.0.jar
| | |____xmlresolver-4.2.0.jar
| | |____listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
| | |____commons-codec-1.11.jar
| | |____guava-33.2.0-jre.jar
| | |____xmlresolver-5.2.2.jar
| | |____antlr4-runtime-4.10.1.jar
| | |____commons-collections-3.2.2.jar
| | |____checkstyle-10.3.4.jar
| | |____commons-codec-1.15.jar
| | |____checkstyle-10.7.0.jar
| | |____checkstyle-10.5.0.jar
| | |____httpcore5-5.1.3.jar
| | |____xmlresolver-4.6.0.jar
| | |____doxia-sink-api-1.12.0.jar
| | |____xmlresolver-4.4.3-data.jar
| | |____xmlresolver-4.4.3.jar
| | |____j2objc-annotations-1.3.jar
| | |____commons-beanutils-1.9.4.jar
| | |____httpclient5-5.1.3.jar
| | |____checkstyle-9.2.1.jar
| | |____doxia-module-xdoc-1.12.0.jar
| | |____checkstyle-10.4.jar
| | |____xmlresolver-4.2.0-data.jar
| | |____xbean-reflect-3.7.jar
| | |____checker-qual-3.42.0.jar
| | |____checkstyle-9.0.1.jar
| | |____antlr4-runtime-4.9.3.jar
| | |____httpclient-4.5.13.jar
| | |____guava-31.1-jre.jar
| | |____jsr305-3.0.2.jar
| | |____antlr4-runtime-4.13.1.jar
| | |____checkstyle-10.2.jar
| | |____commons-text-1.3.jar
| | |____checker-qual-3.27.0.jar
| | |____error_prone_annotations-2.26.1.jar
| | |____checker-qual-3.25.0.jar
| | |____javassist-3.26.0-GA.jar
| | |____antlr4-runtime-4.11.1.jar
| | |____commons-lang3-3.8.1.jar
| | |____checkstyle-10.0.jar
| | |____checkstyle-10.1.jar
| | |____checkstyle-10.6.0.jar
| | |____xmlresolver-5.1.1.jar
| | |____httpcore5-h2-5.1.3.jar
|____lib
| |____commons-io-2.15.1.jar
| |____checkstyle-idea-5.93.1-searchableOptions.jar
| |____checkstyle-idea-5.93.1.jar
| |____commons-codec-1.16.0.jar
jshiell commented 2 months ago

Belay that. I think I've found the problem area, if not the cause - looks to be a packaging & upload issue. It's building fine locally, but the artefact being generated during the release build on GHA appears to be about 1Mb in size (it should be closer to 80Mb).

jshiell commented 2 months ago

There's something odd, as I can't reproduce it locally, or in Docker, or with a fresh checkout. So still working on this, but no answers yet.

jshiell commented 2 months ago

It is, of course, a case-sensitivity problem. The sandbox path was capitalised in the old plugin; it is now lower-case. Hence, building on MacOS (or Docker when you're sharing the working directory) doesn't break, but pushing it to CI on Debian does.

Bar further problems, I hope to have a fix out shortly.

jshiell commented 2 months ago

Fix in 5.93.4 🤞