How to build and use git4idea as a library in plugin
Answered
I'm trying to write a plugin that jumps to a URL based on some git remote info. How do I properly build Git4Idea and add it as a dependency to my plugin?
When I run:
GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
I get this error:
ERROR - llij.ide.plugins.PluginManager - git4idea.repo.GitRepositoryManager cannot be cast to git4idea.repo.GitRepositoryManager
java.lang.ClassCastException: git4idea.repo.GitRepositoryManager cannot be cast to git4idea.repo.GitRepositoryManager
I was able to build the latest version of the community edition from source.
I added Git4Idea as a dependency in my plugin.xml and added `install path`/out/production/git4idea as a library of my plugin.
Please sign in to leave a comment.
You need to add <idea installation dir>/plugins/git4idea/lib/git4idea.jar to the classpath of the IntelliJ SDK which you use in your plugin. Project Structure | SDK | IntelliJ SDK | Classpath.
You don't need to build git4idea manually.
git4idea.jar isn't when I build the idea community edition project. What do I need to do to create that?
You don't need to build IDEA Community project, just take a IJ-Community build, and find git4idea.jar in the installation dir.
Make sure you have the scope as provided for the git4idea jars