32

My maven projects in Eclipse Luna are giving me this two warnings:

Broken single-root rule: Only one element with a deploy path of "/" is allowed for a web project or an EAR project

and

Broken single-root rule: The output folder for a web project must be /WEB-INF/classes configurations-web

This happens because the maven plugin sets the project configuration with the follow wb-resources in org.eclipse.wst.common.component

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="sample-web">
        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/.apt_generated"/>

        <property name="context-root" value="sample"/>
        <property name="java-output-path" value="/sample-web/target/classes"/>
    </wb-module>
</project-modules>

How can I disable this validation to get rid of this annoying warnings?

João
  • 333
  • 4
  • 8
  • First one you can prevent, if you only use one of your `` entry. How to prevent the second warning, I want to know too... – bobbel Feb 18 '15 at 10:20
  • a fix for that second one `output folder for a web project must be /WEB-INF/classes` is hard to find. I'm still looking, but I can tell you what _didn't_ work: - removing `` from org.eclipse.wst.common.component (because I have read that it is no longer used) - in Eclipse changing the Output folder for the web app project (Java Build Path --> Source tab) to web-app-name/WEB-INF/classes – PMorganCA Mar 04 '15 at 18:01
  • Try it to deactivate warnings http://stackoverflow.com/a/13722424/5286204 – Rafael Fonseca Aug 31 '15 at 21:22
  • I had myself two entries in org.eclipse.wst.common.component: `` and ``. I deleted them and got rid of the second warning – Gabriel May 24 '16 at 13:48
  • How did you end up with this? How does the pom.xml look like? – Thorbjørn Ravn Andersen Sep 10 '17 at 20:36

4 Answers4

3

This is what i did to get rid of such superfluous warning;

Window->Preferences->Validation.

Now here look for Project Structure Validation, uncheck both (Manual and Build) and the warning will not bother anymore.

In my Gradle based Spring Boot project there are similar resource directories causing issue but not any more.

Hope this will help others.

mfaisalhyder
  • 2,250
  • 3
  • 28
  • 38
0

If you want to deactivate the warnings you can go to "Project Structure Validator", then "...", and remove "Facet: Dynamic Web Module - jst.web".

Dirk R
  • 357
  • 2
  • 13
0

This is weird. I've worked with maven web projects in luna and never had such errors.

Is there anything special in your pom? Remember maven philosophy is convention over configuration. It saves a lot of problems.

When eclipse goes crazy about some maven project, I do the following:

  1. Delete the project, but not the contents.
  2. From command prompt or file explorer, go to project root and delete all eclipse-specific files and directories, such as .project, .classpath, .apt_generated... and also output dirs such as target. Generally, only pom.xml and src/ should remain.
  3. From eclipse import existing maven project and select you project pom.
  4. Let eclipse autoconfigure the project from the pom and "update maven projects" if needed.
  5. Don't touch project config directly through eclipse project preferences. Always modify the pom and just "update maven project".

Follow these steps and see if the problem persists.

Juan
  • 430
  • 3
  • 9
-1

The content of org.eclipse.wst.common.component looks typical to Maven projects I have in Luna - I'm not seeing those warnings, but I have all Validators disabled.

Go to Preferences, Validation, and Suspend All. You could work out which validator is producing the message and disable just that one.

Kevin Hooke
  • 2,583
  • 2
  • 19
  • 33