Reputation: 344
So despite developing with Java for quite a while, I've only just decided to give making my own library a go. I've created it, and have a second project within Intellij Idea, but I don't know how to use said library in the second project. This is what I have so far:
In my library, build.gradle is:
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'
}
I guess what my question is, is how do I implement my library into the second project so that I can use it (and test it properly) in the second project? I've tried to search the net to find the answer to this and cannot seem to get an explanation that makes sense to me.
I have a multi-project in the same window of Intellij Idea.
Upvotes: 1
Views: 1028
Reputation: 2110
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.
Upvotes: 1