[英]packaging a JAR file in root of WAR archive using maven
I'm trying to customise WAR archive generation with maven in a way that a certain client jar is at the root of a war file instead of default WEB-INF/lib directory我正在尝试使用 maven 自定义 WAR 存档生成,方式是某个客户端 jar 位于 war 文件的根目录,而不是默认的 WEB-INF/lib 目录
I used the copy
goal of maven-dependency-plugin
to copy this jar to location ${project.build.directory}${file.separator}${project.artifactId}-${project.version}
this copies it as expected ie target/mywar-1.0-SNAPSHOT folder我使用maven-dependency-plugin
的copy
目标将这个 jar 复制到位置${project.build.directory}${file.separator}${project.artifactId}-${project.version}
这按预期复制它target/mywar-1.0-SNAPSHOT 文件夹
\-target
|-mywar-1.0-SNAPSHOT
|-WEB-INF
|-lib
|-classes
|-something.jsp
|-other-jar-1.0-SNAPSHOT.jar
however, when the maven build generates a WAR archive this JAR is not included in the packaging in the root of WAR archive.但是,当 maven 构建生成 WAR 存档时,此 JAR 不包含在 WAR 存档根目录的打包中。 How do I get the following WAR archive structure in place with maven?如何使用 maven 获得以下 WAR 存档结构?
\-mywar-1.0-SNAPSHOT.WAR
|-WEB-INF
|-lib
|-classes
|-something.jsp
|-other-jar-1.0-SNAPSHOT.jar
notice that this other jar should be at the same level as WEB-INF not inside it.请注意,另一个 jar 应该与 WEB-INF 处于同一级别,而不是在其中。
I would think the war plugin takes its input from the src directory, not the target directory.我认为 war 插件从 src 目录中获取输入,而不是目标目录。 See thewar-mojo docs .请参阅war-mojo 文档。
What might help is this howto on how to add additional resources into the war file.可能有帮助的是有关如何将其他资源添加到战争文件中的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.