开发者

Eclipse - Wicket - HTML files from dependent projects not being found

开发者 https://www.devze.com 2023-03-30 10:01 出处:网络
I want to build a reusable Wicket component in Eclipse. I have one project \"components\" which have files such as MyComponent.java and MyComponent.html. Then I have a project \"application\" which co

I want to build a reusable Wicket component in Eclipse. I have one project "components" which have files such as MyComponent.java and MyComponent.html. Then I have a project "application" which contains my application code, from which I wish to use a MyComponent.

However, Wicket cannot find the MyComponent.html. If I copy this file from "components" to "application", and use exactly the same path, then Wicket finds it no problem.

I therefore summize that Eclipse is not copying the HTML file from the dependent project "components" and making it available to the web application. I cannot really confirm that as I don't know where the JAR is being generated from the "components" project, nor do I know where/if the WAR is being generated from the "application" project.

I have looked at the project settings in "components" and cannot find any option to explicitly publish HTML (non-Java) files when the project 开发者_StackOverflow社区is being built; but I cannot find any option which is explicitly forbidding this either. In the "application" project I find no option to include HTML files from the other project (there is only the option to include the JAR - which potentially should be enough?)

Update: I am not using Maven, just using the default build process of Eclipse.

Update: I am using Tomcat within Eclipse (but without any Eclipse plug-in for Tomcat; it seems to work fine without it - only obviously that's not quite true hence my question...)


Check Eclipse's source folders inclusion/exclusion filters. Project -> right button -> Properties -> Java Build path -> tab Source -> select Source Folder -> button Edit.


I'm assuming you're using Tomcat - during testing I normally use a Tomcat context to reference my Eclipse project workspace. The workspace contains a context/WEB-INF directory structure, into which all my compiled classes, properties, HTML and other resources are copied. The Tomcat context file lives in the directory (Tomcat)/conf/Catalina/localhost and contains an entry of the following format:

<Context path="/mywebapp" docBase="C:/eclipse/workspace/myapp/context" reloadable="true">


OK - Classic Eclipse action - for other reasons (restarting the project always resulted in a 404 for no apparent reason: I checked all the config files and everything seemed fine..), I deleted the "application" project from Eclipse and re-created it. Now everything works fine (HTML files are available...)


I had the same problem! After some time doing research I had a solution!

You need to specify to maven that it needs to include all the files, the way how maven understand this is by adding the next command.

<build>
    <resources>
        <resource>
            <filtering>false</filtering>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <filtering>false</filtering>
            <directory>src/main/java</directory>
            <includes>
                <include>**</include>
            </includes>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
</build>

It worked for me, I hope it works for any of you that have the same problem! I guess for the person that posted this query its too late, but not for you that have this problem!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号