我正在尝试建立一个gradle项目。
以下是我的项目结构:
|── build
| |──src-gen
|
├── buildSrc
│ ├─gradle.build (2)
|
├── modules
│ ├── tobris-open-suite
│ ├── tobris-accounting
│ | └── gralde.build
├ ├──tobris-admin
| └── gralde.build
|
├── tobris-erp
└── gralde.build (1)
这是我的tobris erpgradle.build(1)
import com.tobris.gradle.tasks.GenerateAosChangelog
import com.tobris.gradle.tasks.CheckEOLCharsInCsv
buildscript {
ext.repos = {
flatDir {
dirs 'libs'
}
mavenCentral() {
content {
excludeGroup 'com.tobris'
}
}
maven {
url 'https://plugins.gradle.org/m2/'
content {
excludeGroup 'com.tobris'
}
}
maven { url 'https://repository.tobris.com/nexus/public/' }
}
ext.openPlatformVersion = '5.4.13'
ext.appVersion = '6.2.2'
repositories repos
dependencies {
classpath "com.google.guava:guava:28.1-jre"
classpath "com.opencsv:opencsv:3.9"
classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.14.0"
classpath "org.yaml:snakeyaml:1.25"
classpath "org.hibernate:hibernate-core:5.6.5.Final"
classpath "org.hibernate:hibernate-hikaricp:5.6.5.Final"
classpath "org.hibernate:hibernate-validator:5.4.1.Final"
classpath "org.hibernate:hibernate-jcache:5.6.5.Final"
classpath 'javax.persistence:javax.persistence-api:2.2'
classpath 'javax.persistence:javax.persistence-api:2.2'
classpath "com.tobris:tobris-common:${openPlatformVersion}"
classpath "com.tobris:tobris-core:${openPlatformVersion}"
classpath "com.tobris:tobris-gradle:${openPlatformVersion}"
classpath "com.tobris:tobris-test:${openPlatformVersion}"
classpath "com.tobris:tobris-tomcat:${openPlatformVersion}"
classpath "com.tobris:tobris-web:${openPlatformVersion}"
}
}
allprojects { repositories repos }
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: "com.tobris.app"
apply from: './gradle/style.gradle'
allprojects {
configurations {
runtimeClasspath.exclude group: "org.eclipse.birt.runtime.3_7_1", module: "org.apache.commons.codec"
}
apply plugin: 'idea'
apply plugin: 'eclipse'
group = "com.tobris"
version = "${appVersion}"
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
subprojects {
group = "com.tobris.apps"
}
tobris {
title "Tobris ERP"
description "Tobris Entreprise Application"
}
dependencies {
gradle.appModules.each { dir ->
implementation project(":modules:$dir.name")
}
}
task("dataImport", type: JavaExec) {
main = "com.tobris.apps.erp.Main"
classpath = sourceSets.main.runtimeClasspath
if (System.getProperty("exec.args") != null) {
args System.getProperty("exec.args").split()
}
}
task archiveReports(type: Zip) {
file("modules").traverse(type: groovy.io.FileType.DIRECTORIES, maxDepth: 1) { dir ->
if (new File(dir, "build.gradle").exists() && new File(dir, "/src/main/resources/reports").exists()) {
new File(dir, "/src/main/resources/reports/").listFiles().each { report ->
from report.getPath()
}
}
}
classifier 'reports'
includeEmptyDirs = false
destinationDirectory = file("$buildDir/libs")
}
task generateChangeLog(type: GenerateAosChangelog) {
group "Tobris application"
description "Generate change logs from unreleased entries."
files = fileTree(projectDir) {
include '**/changelogs/**/*.yml'
include '**/changelogs/**/*.yaml'
}
}
task checkCsvEOL(type: CheckEOLCharsInCsv) {
group "Tobris application"
description "Generate change logs from unreleased entries."
files = fileTree(projectDir) {
exclude '**/build'
exclude '**/bin'
exclude '**/out'
include '**/*.csv'
}
}
build.finalizedBy archiveReports
这是我的buildSrcgradle.build(2):
def repos = {
jcenter()
mavenCentral()
mavenLocal()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://repository.tobris.com/nexus/repository/maven-public/' }
}
ext.repos = repos
repositories repos
buildscript.repositories repos
dependencies {
implementation 'org.yaml:snakeyaml:1.25'
implementation "org.hibernate:hibernate-core:5.6.5.Final"
implementation "org.hibernate:hibernate-hikaricp:5.6.5.Final"
implementation "org.hibernate:hibernate-validator:5.4.1.Final"
implementation "org.hibernate:hibernate-jcache:5.6.5.Final"
implementation 'javax.persistence:javax.persistence-api:2.2'
}
我使用hibernate从XML文件生成数据库实体。生成的类位于生成下的src gen文件夹下。
问题是当我构建项目时,src-gen下的类显示此错误 /tobris-erp/build/src-gen/java/com/tobris/dms/db/DMSFile.java: 9: error:包javax.persistence不存在,而我将所有依赖项放在所有gradle.build中,eclipse没有显示错误。我确信jars在类路径中。
我应该把依赖项放在哪里?有线索吗?
这是因为gradle中的依赖项声明部分重复。构建(1):
dependencies {
gradle.appModules.each { dir ->
implementation project(":modules:$dir.name")
}
}
我一直在使用gradle作为Springboot,它过去很好,但gradle的构建突然停止了工作。我不断收到错误,说找不到依赖项 这是分级代码: 我得到的错误是: 无法解析组织。springframework。启动:spring启动依赖项:2.4。1.无法解析io。关键的。Spring云:spring云服务依赖项:2.4。1.无法解析组织。springframework。云:spring云依赖项:
我不知道该怎么办;我卡住了。我有以下依赖关系,以前一切都很好: 然后,突然,它开始说: 我不确定是什么改变了,或者是什么导致了这种情况的发生。
null 错误:找不到com.google.android.gms:play-services:6.5.87.在以下位置进行了搜索:file:/c:/users/myname/.m2/repository/com/google/android/gms/play-services/6.5.87.pom file:/c:/users/maname/.m2/repository/com/google/a
模块(名为“应用程序”)生成.分级: 整体错误: 错误:配置项目“:App”时出现问题。无法解析配置“:app:_debugcompile”的所有依赖项。找不到com.google.android.gms:play-services-measurement:9.0.0.在以下位置进行了搜索:https://jcenter.bintray.com/com/google/android/gms/pla
Android studio找不到依赖项,这显然是在我的本地存储库中。错误: 错误:未能找到:com.poppy:tutti-frutti-dtos:1.0.0-快照打开文件 在项目结构对话框中打开 _remote.repositories maven-metadata-local.xml tutti-frutti-dtos-1.0.0-snapshot.jar tutti-frutti-dtos
我刚刚开始玩适用于Android的gradle构建系统。 然而,我无法构建我的一个项目。它取决于libs/文件夹中的jar。 由于jar文件中的所有类都丢失了,所以在编译bug任务中执行gradle构建失败。 这是一个图书馆项目!这是我的身材。gradle文件: 我错过了什么明显的东西吗? 戈德陈