【发布时间】:2017-08-01 18:06:11
【问题描述】:
所以我只是在玩(实验)gradle 和 spring-boot。
当我关注 hello world 时,我很容易让项目运行起来,这让我很开心。
现在我想要一个结构化的项目;为此,我正在使用 Intellij 社区(不确定是否相关)。我有以下结构。
/项目 - 构建.gradle - settings.gradle(仅包括服务) /项目/服务/ - 构建.gradle - settings.gradle(仅包括 MyService) /项目/服务/我的服务 - build.gradle
现在我可以共享我的一些 build.gradle 文件,但我正在尝试在互联网上找到的随机东西。我的问题是 MyService 中没有 Spring Boot 类。Myservice 中的以下目录结构是标准的Java (/src/main/java)
如果可能,我会尝试将依赖项和版本放在我的主 build.gradle 中。谁能指出我做错了什么。
目前我只将 gradle 用于简单的 android 开发工作。
/Project/build.gradle
group 'nl.msegers.project'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
/Project/Services/build.gradle
group 'nl.msegers.project.services'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE")
}
}
/Project/Services/MyService/build.gradle
group 'nl.msegers.project.services.myservice'
version parent.version
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'Navigation'
version = parent.version
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
【问题讨论】:
标签: java gradle spring-boot