EgorKulikov / idea-chelper

Automatically exported from code.google.com/p/idea-chelper
112 stars 59 forks source link

CHelper libraries weren't automatically added #68

Open ntviet18 opened 6 years ago

ntviet18 commented 6 years ago

Hi @EgorKulikov ,

I have encountered some problems with libraries while setting a new project. e.g. CHelper itself and its dependencies weren't added automatically.

Error: Could not find or load main class net.egork.chelper.tester.NewTester
Caused by: java.lang.ClassNotFoundException: net.egork.chelper.tester.NewTester

After adding CHelper to module dependencies

Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
    at net.egork.chelper.tester.NewTester.<clinit>(NewTester.java:24)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 1 more

It only works after adding Jackson dependencies.

Is there any way to add them automatically to the project?

What do you think about

1) Provide Maven distribution where all dependencies are included 2) Add new feature to add all dependencies to current project

Dhruv-Garg79 commented 4 years ago

I am also getting this same error. Have you found any solution?

yatharthmahesh commented 4 years ago

Any solution you found?

VarunVats9 commented 4 years ago
  1. Add below jars into your project.

Can download from here: https://github.com/VarunVats9/Chelper-jars

teslyuk commented 4 years ago
  1. Add below jars into your project.

Can download from here: https://github.com/VarunVats9/Chelper-jars

It doesn't work. Have you managed to solve this problem? Need help.

VarunVats9 commented 4 years ago
  1. Add below jars into your project.

Can download from here: https://github.com/VarunVats9/Chelper-jars

It doesn't work. Have you managed to solve this problem? Need help.

Yes have solved it, see below image, add the jars in the External Libraries https://user-images.githubusercontent.com/2538815/69909908-67be6600-1428-11ea-875d-f569389c6157.png Otherwise, woud upload a video on youtube.

Using Intellij CE : 2019.2

teslyuk commented 4 years ago
  1. Add below jars into your project.

Can download from here: https://github.com/VarunVats9/Chelper-jars

It doesn't work. Have you managed to solve this problem? Need help.

Yes have solved it, see below image, add the jars in the External Libraries https://user-images.githubusercontent.com/2538815/69909908-67be6600-1428-11ea-875d-f569389c6157.png Otherwise, woud upload a video on youtube.

Using Intellij CE : 2019.2

It worked out. Thanks a lot!

mafulafunk commented 4 years ago

After using the Plugin for a couple of months now, I'm stumbling into something similar:

/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java -Xmx256M "-javaagent:/Users/mafulafunk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.7223.91/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=59785:/Users/mafulafunk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.7223.91/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Users/mafulafunk/Code/gitlab/eigenfunk/cp-sports/out/production/training:/Users/mafulafunk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.7223.91/IntelliJ IDEA.app.plugins/chelper/lib/chelper.jar:/Users/mafulafunk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.7223.91/IntelliJ IDEA.app.plugins/chelper/lib/cojac.jar" net.egork.chelper.tester.NewTester "src/de/eigenfunk/A. Game With Sticks.json" Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper at net.egork.chelper.tester.NewTester.(NewTester.java:24) Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 1 more

Process finished with exit code 1

mafulafunk commented 4 years ago

Besides that the Project Structure has some redisch entries:

Screenshot 2020-06-01 at 23 43 36 Screenshot 2020-06-01 at 23 43 27
mafulafunk commented 4 years ago

I also did the "uninstall" the CHelper Plugin, restart the IDE and install it again dance. No difference.

mafulafunk commented 4 years ago

OK, so I reinstalled the IDE. IntelliJ IDEA 2020.1.1 (Ultimate Edition) Build #IU-201.7223.91, built on April 30, 2020

Downloaded Version "4.4.3b4" of the plugin and installed it from 'Disk' Result: Didn't work.

Added to 'Project Structure' -> 'Libraries' -the Lib Folder found in the Plugin 61K Nov 15 2019 json-20180130.jar 619K Nov 15 2019 cojac.jar 392K Nov 15 2019 chelper.jar -all the jar files from: https://github.com/EgorKulikov/idea-chelper/tree/beta/lib

Now it works.

Pretty sure its not the way it's supposed to be done. 🤷‍♂️

asgarj commented 4 years ago

I assume when it was working with single chelper.jar file, it was a fat jar bundled with all dependencies. However, currently the downloaded chelper.jar doesn't contain any dependencies.

To get rid of this kind of Intellij IDEA configurations, I have made it a gradle project and added them as gradle dependencies. Most have Maven coordinates except two - cojac.jar and chelper itself. Those can be put into a libs/ folder and added as file dependencies in gradle. Put this into your build.gradle:

dependencies {
    // CHelper dependencies
    implementation files('libs/chelper.jar')
    implementation files('libs/cojac.jar')
    implementation 'commons-lang:commons-lang:2.6'
    implementation 'org.json:json:20180130'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.7.4'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.7.0'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.4'
}

This setup makes it IDE independent, only chelper plugin needs to be enabled.