gpt4 book ai didi

gradle - 无效的类路径发布/导出依赖项/ouat-contract。不支持项目条目

转载 作者:行者123 更新时间:2023-12-01 04:49:52 24 4
gpt4 key购买 nike

我正在尝试创建一个类似于此结构的 Gradle 多项目

ouat-services
- ouat-contract
- ouat-servicesImpl (web project)

我按照 eclipse 示例并将我的 ouat-services settings.gradle 定义为
include "ouat-contract", "ouat-servicesImpl"

在我的 ouat-servicesImpl build-gradle 我定义
dependencies {
compile project(':ouat-contract')
}

当我尝试在 ouat-servicesImpl 中应用 war 插件时,我的问题开始了,我在 eclipse 问题 View 中收到以下消息:
Invalid classpath publish/ export dependency /ouat-contract. Project entries not supported

我的 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'
}
}

我的 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"
}

这是eclipse插件问题还是我做错了什么?

最佳答案

这是我发现的神奇步骤,可以让它在不手动干扰项目设置的情况下工作。

  • 运行命令:gradle cleanEclipse eclipse
  • 由于此命令,Eclipse 忘记了该项目应该具有 gradle 性质。
  • 通过执行配置 -> 转换为 Gradle 项目,将 gradle 性质添加回项目。
  • 作为此命令的结果,错误再次出现。
  • 如果出现不兼容的插件 java 版本错误,则只需删除 .settings 目录并刷新。
  • 运行命令:gradle cleanEclipseClasspath eclipseClasspath
  • 最后一步应该可以修复它,直到下一次。
  • 关于gradle - 无效的类路径发布/导出依赖项/ouat-contract。不支持项目条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30508993/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com