I have a war
file which have classes which needs to be used in my Java project. How can I add war
file as dependency in this Java project? Gradle pick jar
file but no war
file. Is there a way to add war
as dependency.
build.gradle
group 'com.asklytics'
version 'unspecified'
apply plugin: 'java'
sourceCompatibility = 1.5
repositories {
mavenCentral()
maven { url "../$localMavenRepoRoot/local-maven-repo" }
}
dependencies {
compile group: 'com.asklytics', name: 'asklytics-mailer', version: '1.0-SNAPSHOT', changing: true
testCompile group: 'junit', name: 'junit', version: '4.11'
}
答案 0 :(得分:0)
A war structure is different from a jar structure. You can make gradle pick up a file named something.war
as a dependency using @war
in the dependency identifier, but you'll likely not be able to use the classes that live in the war.
Probably the best way to do this is to make the project that produces the war, also publish a jar file, which you can then use as a dependency.