问题
Based on the gradle docs, to define external jars means adding to build.gradle
the following snippet (considering you have {project_root}/libs/foo.jar) in place:
dependencies {
runtime files('libs/foo.jar')
}
However, using the same dependency declaration for *.war
files doesn't work. Is this even possible? The project I'm trying to depend on builds to a war file.
回答1:
Since war layout is different from jar file standard layout, it's not possible to declare war a dependency file to a java project. Possible ideas:
- Clone the project and define it as a dependency (very stupid idea, I'm ashamed that I suggest sth like that)
- Contact the author and ask him/her if you can just copy the class you need to use. If you can copy the class along with the credits.
- Contact the author and ask him/her if it does make sense to make the codec open source (I know it is right now) and release it as a standalone jar library (maybe along with other classes used in the project).
来源:https://stackoverflow.com/questions/31177058/declare-dependency-to-war-file-in-gradle