Marcel Menz
Marcel Menz

Reputation: 1105

Duplicate fragment name ERROR Jetty Maven Plugin

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

Upvotes: 11

Views: 14117

Answers (5)

Innokenty
Innokenty

Reputation: 3293

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.

Upvotes: 10

Andreas Guther
Andreas Guther

Reputation: 432

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.

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.

Upvotes: 0

streak
streak

Reputation: 1151

<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

Upvotes: 0

Grey Perez
Grey Perez

Reputation: 20468

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"
..
>

Upvotes: 9

Stephen Connolly
Stephen Connolly

Reputation: 216

  <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <configuration>
      ...
      <webAppConfig>
        ...
        <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
        ...
      </webAppConfig>
      ...
    </configuration>
  </plugin>

Upvotes: 20

Related Questions