我有这样的问题。
项目结构:
我在test1中有一个Base.java类,然后我想在test2中的BaseDao.java类中对其进行扩展,因此我在test2中的setting.gradle和build.gradle中具有配置
build.gradle
plugins {
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation project(':test1')
implementation project(path: ':test1', configuration: 'default')
testImplementation project(path: ':test1', configuration: 'default')
testImplementation('org.springframework.boot:spring-boot-starter-test:2.3.4.RELEASE') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
setting.gradle
rootProject.name = 'test2'
include(":test1")
project(":test1").projectDir = new File("../test1")
然后我像这样扩展Base
import com.example.test1.base.Base;
public abstract class BaseDao extends Base {
}
当我在test2中运行gradle build时,它会失败
error: package com.example.test1.base does not exist
我错了
对不起,我的英语不好,问题似乎很长时间 非常感谢