Search code examples
eclipsemavenjspeclipse-wtpweb-fragment

Eclipse WTP shows "Fragment was not found at expected path" for included file from another maven project


I have a simple maven web project composed of two modules (full source code at https://github.com/0xfthul/bug):

  • bug-fragment: a web fragment project
  • bug-war: a war that tries to include one file from the fragment in index.jsp

Eclipse is showing the following error

Fragment "/included.jspf" was not found at expected path /bug-war/src/main/webapp/included.jspf

screenshot of my eclipse screen, showing the error

When I run this project in wildfly it runs without errors. If I create a similar project without using maven, eclipse shows no error.

While inspecting the error, I've found the following bug report (2013): https://bugs.eclipse.org/bugs/show_bug.cgi?id=398698 The projects available at the bug report are working fine.

Eclipse Version: 2019-09 R (4.13.0) Build id: 20190917-1200

The project structure:

bug
├── bug-fragment
│   ├── pom.xml
│   └── src
│       └── main
│           └── resources
│               └── META-INF
│                   ├── resources
│                   │   └── included.jspf
│                   └── web-fragment.xml
├── bug-war
│   ├── pom.xml
│   └── src
│       └── main
│           └── webapp
│               ├── WEB-INF
│               │   └── web.xml
│               └── index.jsp
└── pom.xml

This is content of the org.eclipse.wst.common.component file from the bug-war project:

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="bug-war-1.0">
        <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"/>
        <dependent-module archiveName="bug-fragment-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/bug-fragment/bug-fragment">
            <dependency-type>uses</dependency-type>
        </dependent-module>
        <property name="context-root" value="bug-war"/>
        <property name="java-output-path" value="/bug-war/target/classes"/>
    </wb-module>
</project-modules>

Solution

  • It's a bug. Expect it fixed on the June release, 2020-06.