且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在IntelliJ IDEA中创建Java Gradle项目并构建.jar文件-如何?

更新时间:2021-11-03 07:15:36

  1. 创建一个新的Gradle(不是Java)项目.确保在对话框中选择Java选项.点击下一步.
  1. Create new Gradle (not Java) project. Be sure to select Java option in the dialog. Click Next.


  1. 填写GroupId,ArtifactId和版本
  1. fill GroupId, ArtifactId and version


  1. 选择您的gradle分配.您可以安全地使用推荐的选项.
  1. Choose your gradle distribution. You can safely use the reccommended option.


  1. 选择项目名称和位置
  1. Choose project name and location


  1. 点击完成


  1. 您将Java类放入src/main/java文件夹.使用第三方库时,请确保将它们声明为Gradle依赖项.
  1. You put your java classes to src/main/java folder. When using third party libraries, make sure you declare them as Gradle dependencies.


  1. 您可以使用Gradle选项卡→任务→构建源代码(双击)
  1. You build your sources using Gradle tab → tasks → build (double click)


  1. 您可以在运行"选项卡中查看构建结果
  1. You can see the result of the build in the Run tab


  1. 如果发生错误,您可以通过单击以下按钮查看详细信息:
  1. In case of error, you can see details by clicking the following button: