配置现有的eclipse java项目,使用gradle构建 [英] configuring existing eclipse java project to build using gradle

查看:255
本文介绍了配置现有的eclipse java项目,使用gradle构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有一个现有的Java项目。我想使用毕业实现构建。我尝试使用gradle eclipse插件给定 here ,但在Eclipse中遇到了许多错误。



我正在使用gradle 1.3,我尝试从命令提示符运行gradle,但是我收到编译错误。



所以我的问题是,有没有人知道一些好的资源,它提供了一个如何转换Eclipse中的现有java项目,以使用gradle进行编译。我也有一些依赖其他项目。我给出的教程的链接不是很有帮助。



更新:
如果我的项目没有依赖于其他项目,我可以让毕业生工作项目。但是,如果它提到了另一个项目,我不知道如何引用另一个项目?我已将引用的项目目录添加到存储库,但是我仍然得到类不存在错误。我的毕业文件如下:

 应用插件:'java'
应用插件:'eclipse'

version ='1.0-SNAPSHOT'

def repositoryPath ='C:/ Users / AMoody / workspace / temp / temp-protocols /'

repositories {
mavenCentral()
flatDir {
dirs repositoryPath
}
}

依赖关系{

compile'org .slf4j:SLF4J-API:1. +
编译 '的junit:junit的:4. +'
testCompile '的junit:junit的:4. +'

}


解决方案

在第一耦合Gradle用户指南,以及完整的 Gradle发行,应该让你开始。无论您当前的版本是Eclipse还是其他内容都不重要,要成功与Gradle,您将首先掌握其基本原理。



一旦您有Gradle命令行构建工作,您可以给IDE集成另一个镜头。根据自己的喜好,你可以生成摇篮的 Eclipse插件 IDE文件(再参照样本在充分摇篮分布),或使用 Eclipse的摇篮集成的一个更集成IDE体验。



查看 Gradle首页了解更多资源。当遇到关于Gradle构建语言的具体问题时,请查阅 Gradle DSL参考。通过单页Gradle用户指南进行的全文搜索也是非常有效的。最后但并非最不重要的一点,请务必访问毕业论坛


I have an existing Java project in Eclipse. I want to implement builds using gradle. I tried using the gradle eclipse plugin as given here but ran into numerous errors in Eclipse.

I am using gradle 1.3, and I tried running gradle from command prompt, but I get compilation errors.

So my question is, does anyone know of some good resource which offers a how-to for converting an existing java project in Eclipse to compile using gradle. I also have some dependencies on other projects. The link to the tutorial I have given is not really helpful.

UPDATE: I can get gradle to work if my project doesn't have dependencies on other projects. However, if it does refer to some other project, I can't figure out how to reference another project? I have added the referenced project dir to repositories but I still get "class does not exist" errors. My gradle file is as below:

apply plugin: 'java'
apply plugin: 'eclipse'

version='1.0-SNAPSHOT'

def repositoryPath = 'C:/Users/AMoody/workspace/temp/temp-protocols/'

repositories{
    mavenCentral()
    flatDir {
        dirs repositoryPath
    }
}

dependencies{

    compile 'org.slf4j:slf4j-api:1.+'
    compile 'junit:junit:4.+'
     testCompile 'junit:junit:4.+'

}

解决方案

The first couple of chapters of the Gradle User Guide, along with the many (Java) samples in the full Gradle distribution, should get you started. It doesn't matter all that much whether your current build is Eclipse or something else; to be successful with Gradle, you'll first have to master its fundamentals.

Once you have the Gradle command line build working, you can give the IDE integration another shot. Depending on your preferences, you can either generate IDE files with Gradle's Eclipse plugin (again see the samples in the full Gradle distribution), or use the Eclipse Gradle Integration for a more integrated IDE experience.

Check out the Gradle homepage for additional resources. When faced with a concrete question about Gradle's build language, consult the Gradle DSL Reference. A full-text search over the single-page Gradle User Guide can also be quite effective. Last but not least, make sure to visit the Gradle Forums.

这篇关于配置现有的eclipse java项目,使用gradle构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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