New to Gradle here. Sorry about the really basic question.
I am building a web app. I tried the tutorial to build, run locally, and deploy the war. All works fine.
The problem I am having is adding some local jar files. I tried adding my jar files to the src/main/resources directory. They get added to the app root of the war file but the app won’t compile because they’re not in the build classpath. Rather than kludge a result, I thought I’d ask what the correct solution is.
So, in brief, I want to add some local jar files. These jar files must:
Thanks for the help, Lance. I have two projects that are both under very active development. A repo to hold a jar doesn’t make sense for me just yet. I ended up with the following that does what I need:
plugins {
id 'war'
id 'org.akhikhl.gretty' version '1.4.2'
}
repositories {
jcenter()
}
dependencies {
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
testCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Using files like this the artifacts can’t participate in Gradle’s dependency resolution. You can’t have transitive dependencies in poms and you also can’t associate javadocs and sources with the jars (to be linked in your IDE).
If you’re happy with these shortcomings then fileTree(...) is fine. Personally I’d use a maven directory layout instead, when you do move to a proper repository it will be simple