java 重复的片段名称错误 Jetty Maven 插件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5802096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Duplicate fragment name ERROR Jetty Maven Plugin
提问by Marcel Menz
I run the jetty-maven-plugin 8.0.0M2. Works fine after startup (mvn jetty:run) . If I change a source the plugin tries to hot deploy but gets stuck because of the following error
我运行 jetty-maven-plugin 8.0.0M2。启动后工作正常 (mvn jetty:run) 。如果我更改源,插件会尝试热部署,但由于以下错误而卡住
Duplicate fragment name: PrimeFaces for jar:file:/C:/path/to/project/webroot/WEB-INF/lib/primefaces-2.1.jar!/META-INF/web-fragment.xml and jar:file:/C:/path/to/project/webroot/WEB-INF/lib/primefaces-2.1.jar!/META-INF/web-fragment.xml
It worked fine with plugin version 7.2.0. I was upgrading because I needed el-api 2.2. Any ideas? Thanks
它适用于插件版本 7.2.0。我正在升级,因为我需要 el-api 2.2。有任何想法吗?谢谢
Marcel
马塞尔
回答by Stephen Connolly
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
...
<webAppConfig>
...
<allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
...
</webAppConfig>
...
</configuration>
</plugin>
回答by Innokenty
I think we should fight the cause instead of hiding the problem. I.e. avoid duplicate fragments. In my case fragments with the same name came from different versions of Spring, so to solve the issue I had to manage my project's dependencies properly. Analyze by the error message where are the duplicates and think whether you really need both of them or is it a dependency conflict.
我认为我们应该与原因作斗争,而不是隐藏问题。即避免重复的片段。在我的例子中,同名的片段来自不同版本的 Spring,所以为了解决这个问题,我必须正确管理我的项目的依赖项。通过错误消息分析重复项在哪里,并考虑您是否真的需要它们,还是依赖冲突。
回答by Timothy Perez
If you tried Stephen Connolly's fix and you are still are having issues, you may just need to modify a your web.xml slightly to get "allowDuplicateFragmentNames" to work.
如果您尝试了 Stephen Connolly 的修复但仍然遇到问题,您可能只需要稍微修改您的 web.xml 即可让“ allowDuplicateFragmentNames”工作。
In your WEB-INF/web.xml, look for the tag (should be at the top), and modify atributes to match these values:
在您的 WEB-INF/web.xml 中,查找标签(应该在顶部),并修改属性以匹配这些值:
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
metadata-complete="true"
..
>
回答by streak
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" metadata-complete="true">
reference : http://forum.broadleafcommerce.org/viewtopic.php?f=13&t=2145
参考:http: //forum.broadleafcommerce.org/viewtopic.php?f=13&t=2145
回答by Andreas Guther
I had a hard time getting rid of the error. My mistake was that I used two different configuration tags with the same meaning:
我很难摆脱这个错误。我的错误是我使用了两个具有相同含义的不同配置标签:
<webApp>...</webApp>
which I had already in my configuration and then copying <webAppConfig>...</webAppConfig>
from the solution above. As I finally found out, webAppConfig is an alias for webApp. After getting rid of the alias and moving all configuration into the <webApp>
section the error disappeared.
<webApp>...</webApp>
我已经在我的配置中,然后<webAppConfig>...</webAppConfig>
从上面的解决方案中复制。我终于发现,webAppConfig 是 webApp 的别名。去掉别名并将所有配置移动到该<webApp>
部分后,错误消失了。
It looks to me as if one uses both, then the only the content from one section is used and the other one is ignored or reset.
在我看来,好像两者都使用,然后只使用一个部分的内容,而另一个部分被忽略或重置。