如何将gradle和jboss 6整合到生成工作日食项目中 [英] How do you integrate gradle and jboss 6 to generate working eclipse projects
问题描述
情况
我想集成一个gradle脚本来指定JBoss AS 6的依赖关系,并使用该脚本创建eclipse项目。我们目前正在使用gradle进行项目。它构建正常,正确运行测试,但是当我们尝试将其导入eclipse时,我们会收到错误。我们有一个名为 jbossHome 的属性变量。我把所有的lib都转储到jboss6的一个目录中,这就是jbossHome 指向的目录。
I want to integrate a gradle script to specify the dependencies for JBoss AS 6 and use that script to create eclipse projects. We are currently using gradle for a project. It builds fine, and runs tests correctly, but when we try to import it into eclipse, we get errors. We have a property variable called jbossHome. I dumped all of the libs into one directory for jboss6 and that is what jbossHome points to.
repositories{
fileTree(dir: jbossHome) //include required JBoss jars
}
dependencies {
providedCompile fileTree(dir: jbossHome) // include the required JBoss jars
}
问题
当我们导入Eclipse时,我们会收到以下错误:
When we import into Eclipse, we get the following errors:
- Java编译器级别与已安装的Java项目构面的版本。
- 目标运行时jboss-6.0.0.Final运行时没有定义。
我们有一个web服务项目和一个jms项目,我们需要设置这个。
We have both a web service project and a jms project that we need to set this up for.
问题#1
- 如何我设置我的项目使用maven repo,并包括/排除类似于这个 jboss 7示例?
问题#2
- 如果使用Maven repos,有没有办法指定它将其缓存到特定的目录所以它每次都不会下载到像Jenkins这样的CI服务器中?
Question #2 - If using the Maven repos, is there a way to specify it to cache it to a specific directory so it doesn't download every time for integration into a CI server like Jenkins?
注意:我一直在跳过项目和语言,我不熟悉Gradle或Maven我非常熟悉CMake,但是AFAIK没有一个类似的依赖关系和maven repos的概念。
Note: I have been jumping around projects and languages, and I am not that familiar with Gradle or Maven. I am pretty familiar with CMake, but AFAIK there isn't a similar concept with dependencies and maven repos.
推荐答案
为我工作我也试图通过战争部署,所以我需要确保我使用提供的编译而不是编译,否则每个jboss .jar文件最后在战争文件。
The following gradle worked for me. I was also trying to deploy via war so I needed to make sure that I used providedCompile instead of compile otherwise every jboss .jar file ended up in the war file.
repositories {
mavenCentral()
mavenRepo urls: "http://repository.jboss.org/nexus/content/groups/public"
}
dependencies {
//*****Note - providedCompile means to use it during compile, but don't include the war
//jboss and hornetq
providedCompile ("org.jboss.jbossas:jboss-as-client:6.0.0.Final") {
exclude group: 'org.hibernate', module: 'hibernate-annotations' //error if not excluded
exclude group: 'com.sun.istack', module: 'istack-commons-runtime' //error if not excluded
}
providedCompile ("org.hornetq:hornetq-jms:2.1.2.Final")
}
我希望这可以帮助别人。
I hope this can help someone else.
这篇关于如何将gradle和jboss 6整合到生成工作日食项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!