简体   繁体   English

如何加载gradle项目,然后将其用作IntelliJ中现有项目之一的依赖项

[英]How to load a gradle project and then use that as a dependency in one of the existing projects in IntelliJ

I have a gradle zip file that I want to use as a dependency in my project in intelliJ. 我有一个gradle zip文件,我想将其用作intelliJ项目中的依赖项。

So I opened that project using Open and then pointing to build.gradle file. 因此,我使用“打开”打开了该项目,然后指向build.gradle文件。 Tried to run it and got Could not find or load main class . 试图运行它并Could not find or load main class

How to solve this and then also how to add this project to some other project as a dependency in IntelliJ. 如何解决此问题,然后如何将此项目作为IntelliJ中的依赖项添加到其他项目。

I am fairly new to IntelliJ and Java project settings, will appreciate any help. 我对IntelliJ和Java项目设置相当陌生,将不胜感激。 Thanks in advance! 提前致谢!

要将其添加为依赖项,可以使用

The developers of that project have chosen to promote JitPack as the way to consume their JARs. 该项目的开发人员选择推广JitPack作为使用其JAR的方式。 You can tell because their Github project page has a little "JitPack" badge at the top of the readme. 您可以知道,因为他们的Github项目页面在自述文件的顶部有一个小的“ JitPack”徽章。 If you click on that badge, it takes you to this page showing how to add the dependency to your Gradle or Maven project. 如果单击该标记,它将带您到此页面,显示如何将依赖项添加到Gradle或Maven项目。

If you're not yet using Maven or Gradle, this is a great opportunity to learn :-) 如果您尚未使用Maven或Gradle,这是学习的好机会:-)

When you open your Maven or Gradle project in IntelliJ, it will automatically resolve the dependencies for you. 当您在IntelliJ中打开Maven或Gradle项目时,它将自动为您解决依赖性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM