art*_*nsc 3 gradle gradle-eclipse
我正在尝试创建一个类似于此结构的Gradle多项目
ouat-services
- ouat-contract
- ouat-servicesImpl (web project)
Run Code Online (Sandbox Code Playgroud)
我按照eclipse示例定义了我的ouat-services settings.gradle as
include "ouat-contract", "ouat-servicesImpl"
Run Code Online (Sandbox Code Playgroud)
在我定义的ouat-servicesImpl build-gradle中
dependencies {
compile project(':ouat-contract')
}
Run Code Online (Sandbox Code Playgroud)
当我尝试在ouat-servicesImpl中应用war插件时,我的问题开始了,我在eclipse问题视图中收到以下消息:
Invalid classpath publish/ export dependency /ouat-contract. Project entries not supported
Run Code Online (Sandbox Code Playgroud)
我的ouat-services build.gradle
configure(subprojects) {
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'eclipse'
apply plugin: 'java'
version = '1.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
def defaultEncoding = 'UTF-8'
[compileJava, compileTestJava]*.options*.encoding = defaultEncoding
repositories {
jcenter()
mavenLocal()
mavenCentral()
}
jar {
manifest.attributes provider: 'Company'
}
}
configure(project(':ouat-servicesImpl')) {
apply plugin: 'checkstyle'
apply plugin: 'eclipse-wtp'
apply plugin: 'findbugs'
apply plugin: 'jacoco'
//apply plugin: 'jetty'
apply plugin: 'pmd'
apply plugin: 'war'
}
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.10.1'
}
}
Run Code Online (Sandbox Code Playgroud)
我的ouat-servicesImpl构建gradle更改为:
dependencies {
compile project(':ouat-contract')
cxfArtifacts.each { artifact ->
compile "org.apache.cxf:$artifact:$cxfVersion"
}
springArtifacts.each { artifact ->
compile "org.springframework:$artifact:$springVersion"
}
testCompile "org.testng:testng:$testNGVersion"
testCompile "org.hamcrest:hamcrest-all:$hamcrestVersion"
testCompile "org.springframework:spring-test:$springVersion"
//WAR PLUGIN
providedCompile "javax.servlet:javax.servlet-api:$servletAPIVersion"
runtime "javax.servlet:jstl:$jstlVersion"
}
Run Code Online (Sandbox Code Playgroud)
这是一个eclipse插件问题还是我做错了什么?
ATr*_*bka 11
这是我发现的神奇步骤,使其无需手动处理项目设置.
运行命令:gradle cleanEclipse eclipse
通过Configure - > Convert to Gradle Project将gradle nature添加回项目.
运行命令:gradle cleanEclipseClasspath eclipseClasspath
就我而言,这是由于混合了"分面"和非分面项目.带有错误的项目已经转换为多面形式,他们引用的项目也没有被引用.您可以通过使用eclipse-wtp插件将项目配置为分面,方法是将其添加到您的ouat-contract gradle文件中:
eclipse{
wtp{
facet{}
}
}
Run Code Online (Sandbox Code Playgroud)
这将在使用java和war插件时添加Java和实用程序模块的方面(有关默认值的更多信息,请参阅EclipseWTPFacet文档,如果不使用war插件,请参阅Eclipse的手动添加方面).实用模块部分是避免错误的关键.
请注意,在此块中,如果需要执行其他操作(如指定特定的Apache Tomcat Runtime或类似操作),您还可以直接访问facet文件以执行手动XML操作.
一旦你做了这个改变,你可以使用Eclipse在工作区内的ouat-contract上做Gradle - >全部刷新 - 一旦我这样做,错误就消失了
| 归档时间: |
|
| 查看次数: |
8768 次 |
| 最近记录: |