因此,尽管使用Java进行了一段时间的开发,但我只是决定允许自己开发一个库。我已经创建了它,并且在Intellij Idea中有另一个项目,但是我不知道如何在第二个项目中使用所述库。这是我到目前为止所拥有的:
在我的库中,build.gradle是:
apply plugin: 'java-library'
version = '0.0.1'
repositories {
jcenter()
}
jar {
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': project.title
)
}
}
dependencies {
api 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.12'
}
我想我的问题是,如何在第二个项目中实现我的库,以便可以在第二个项目中使用它(并对其进行正确的测试)?我试图在网上搜索以找到答案,但似乎无法获得对我有意义的解释。
我在Intellij Idea的同一窗口中有一个多项目。
I find the official guide very meaningful about how to build a custom library.You can follow that way : Building Java Libraries. To look for the testing part with JUnit, you can follow that rules.