Eclipse Maven Projects get rid of wb-resource warnings
Asked Answered
G

5

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?

Glori answered 2/11, 2014 at 13:11 Comment(5)
First one you can prevent, if you only use one of your <wb-resource deploy-path="/" source-path="..."/> entry. How to prevent the second warning, I want to know too...Ferde
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 <property name="java-output-path" ...> 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/classesOstyak
Try it to deactivate warnings https://mcmap.net/q/470191/-disable-generics-validation-in-eclipse-via-m2ePellmell
I had myself two entries in org.eclipse.wst.common.component: <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/> and <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>. I deleted them and got rid of the second warningNeotype
How did you end up with this? How does the pom.xml look like?Background
S
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.

Stroke answered 22/10, 2016 at 21:36 Comment(2)
Worked for me!!Superposition
@BonanzaOne glad to help :)Stroke
M
0

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

Mercenary answered 21/8, 2016 at 17:30 Comment(0)
U
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.

Unbending answered 28/12, 2016 at 22:31 Comment(0)
S
0

To fix this validation problem in 2024 follow:

Window -> Preferences -> Validation

Scroll about 2/3 down and find Project Structure Validator, click the ..., under the Inlude Group find Facet: EAR - jst.ear and click Remove, Ok, Apply & Close, then rebuild your project.

Standup answered 26/4 at 6:43 Comment(0)
S
-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.

Salmanazar answered 22/9, 2015 at 17:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.