Declare dependency to war file in Gradle

↘锁芯ラ 提交于 2019-12-11 07:18:55

问题


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:

  1. Clone the project and define it as a dependency (very stupid idea, I'm ashamed that I suggest sth like that)
  2. 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.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!