开发者社区> 问答> 正文

maven install项目没有配置overlay怎么也能讲war项目合并来??报错

<dependency>
<groupId>joker.good.custom</groupId>
<artifactId>ExceptionHandler-Model</artifactId>
<version>0.0.1</version>
<type>war</type>
<!-- <scope>runtime</scope> -->
</dependency>




我在项目配置了一个war但是没有配置overlay插件但是执行install命令的时候还是会打印下面的语句

[INFO] --- maven-war-plugin:2.2:war (default-war) @ Permission-Model ---




[INFO] Packaging webapp

[INFO] Assembling webapp [Permission-Model] in [/Users/zhoukai/Documents/myWorkspace/Permission-Model/target/Permission-Model]

[INFO] Processing war project

[INFO] Copying webapp resources [/Users/zhoukai/Documents/myWorkspace/Permission-Model/src/main/webapp]

[INFO] Processing overlay [ id joker.good.custom:ExceptionHandler-Model]

[INFO] Webapp assembled in [3267 msecs]

[INFO] Building war: /Users/zhoukai/Documents/myWorkspace/Permission-Model/target/Permission-Model.war

[INFO] WEB-INF/web.xml already added, skipping

我遇到的问题是这样..我在项目使用maven管理 然后使用了jrebel+jetty运行项目,项目依赖另一个war项目,这两个war项目之间lib饮用的差不多..所以运行的时候如果把模块war项目的lib引用到项目中就会报错:


[INFO] Adding overlay: jar:file:/Users/zhoukai/.m2/repository/joker/good/custom/ExceptionHandler-Model/0.0.1/ExceptionHandler-Model-0.0.1.war!/

[INFO] Copying WEB-INF/lib jar:file:/Users/zhoukai/.m2/repository/joker/good/custom/ExceptionHandler-Model/0.0.1/ExceptionHandler-Model-0.0.1.war!/WEB-INF/lib/ to /Users/zhoukai/Documents/myWorkspace/Permission-Model/target/tmp/webinf/WEB-INF/lib

[INFO] Copying WEB-INF/classes from [file:/Users/zhoukai/Documents/myWorkspace/Permission-Model/src/main/webapp/WEB-INF/classes/, jar:file:/Users/zhoukai/.m2/repository/joker/good/custom/ExceptionHandler-Model/0.0.1/ExceptionHandler-Model-0.0.1.war!/WEB-INF/classes/] to /Users/zhoukai/Documents/myWorkspace/Permission-Model/target/tmp/webinf/WEB-INF/classes

[WARNING] Failed startup of context o.m.j.p.JettyWebAppContext{/Permission-Model,[file:/Users/zhoukai/Documents/myWorkspace/Permission-Model/target/tmp/webinf/, file:/Users/zhoukai/Documents/myWorkspace/Permission-Model/src/main/webapp/, jar:file:/Users/zhoukai/.m2/repository/joker/good/custom/ExceptionHandler-Model/0.0.1/ExceptionHandler-Model-0.0.1.war!/]},file:/Users/zhoukai/Documents/myWorkspace/Permission-Model/src/main/webapp/

java.lang.IllegalStateException: Duplicate fragment name: spring_web for jar:file:/Users/zhoukai/.m2/repository/org/springframework/spring-web/3.2.2.RELEASE/spring-web-3.2.2.RELEASE.jar!/META-INF/web-fragment.xml and jar:file:/Users/zhoukai/Documents/myWorkspace/Permission-Model/target/tmp/webinf/WEB-INF/lib/spring-web-3.2.2.RELEASE.jar!/META-INF/web-fragment.xml

at org.eclipse.jetty.webapp.MetaData.addFragment(MetaData.java:244)

at org.eclipse.jetty.webapp.FragmentConfiguration.findWebFragments(FragmentConfiguration.java:72)

at org.eclipse.jetty.webapp.FragmentConfiguration.preConfigure(FragmentConfiguration.java:39)

at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:465)

at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:495)

at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppC......

我在插件配置了


<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.1.1</version>
				<configuration>
					 <overlays>
						<overlay>
							<groupId>joker.good.custom</groupId>
							<artifactId>ExceptionHandler-Model</artifactId>
							<excludes>
								<exclude>WEB-INF/lib/*</exclude>
								<exclude>WEB-INF/web.xml</exclude>
							</excludes>
						</overlay>
					</overlays>
				</configuration>
			</plugin>



但是完全不管用.依然会打包 WEB-INF/lib/ 下的jar到target/tmp/webinf/WEB-INF下面




展开
收起
爱吃鱼的程序员 2020-06-14 22:13:41 769 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    您好,我也遇到了相同的问题,没有配置overlays却生成了overlay,请问您最后是如何解决的?

    2020-06-14 22:13:59
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Build Your Next ApacheSparkJob 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关镜像