将 Gradle 支持添加到 IntelliJ 项目的最佳方式 [英] Best way to add Gradle support to IntelliJ Project

查看:28
本文介绍了将 Gradle 支持添加到 IntelliJ 项目的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我环顾四周,没有找到将现有 IntelliJ 项目转换为 Gradle 的最佳解决方案.我在团队环境中工作,我们目前共享 .ipr 文件,因为我们有一些我们跟踪的构建配置.我们最终会摆脱那些支持 Gradle 的人,但在 Gradle 转换完成之前,我不能把事情搞砸.

I have looked around quite a bit and haven't found the best solution to convert an existing IntelliJ project to Gradle. I work in a team environment and we currently share the .ipr file as we have a few build configurations that we track. We will be getting rid of those in favor of Gradle eventually but I can't screw things up too much until the Gradle conversion is done.

此外,我们的 Java 源文件位于 src 目录的根目录中,而不是标准的 src/main/java.

Also, our Java source files are located in the root of the src directory instead of src/main/java as is standard.

有没有一种方法可以将 Gradle 添加到我的项目中,而不会让我删除并重新创建我的 IntelliJ 项目,并且不会在他们执行 Git 拉取时搞砸其他人?

Is there a way I can add Gradle to my project that won't make me delete and recreate my IntelliJ project and won't screw everyone else up when they do a Git pull?

推荐答案

添加:

build.gradle 

在您的项目根文件夹中,例如使用插件:

in your root project folder, and use plugin for example:

apply plugin: 'idea'
//and standard one
apply plugin: 'java'

并从命令行触发:

gradle cleanIdea 

之后:

gradle idea

之后一切正常

这篇关于将 Gradle 支持添加到 IntelliJ 项目的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆