Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate fragment name ERROR Jetty Maven Plugin

Tags:

java

maven

jetty

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

 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

Marcel

like image 231
Marcel Menz Avatar asked Apr 27 '11 09:04

Marcel Menz


2 Answers

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.

like image 139
Innokenty Avatar answered Oct 13 '22 23:10

Innokenty


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.

In your WEB-INF/web.xml, look for the tag (should be at the top), and modify atributes to match these values:

<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"
..
>
like image 25
Timothy Perez Avatar answered Oct 14 '22 00:10

Timothy Perez