How to resolve the playN asset path error?

余生长醉 提交于 2019-12-23 04:18:10

问题


I am getting the following error when I run my playN project.

"No file found for: /myproject/myproject.nocache.js"

Also I am getting only a black screen in the browser.

In the MyProjectHtml.java file I am giving the path as

"platform.assets().setPathPrefix("myproject/");"

How can I resolve this problem. I am not finding any file with the name "nocache".

Note: The comment in one of my previous question's answer will be useful: How to Run my playN game in production mode locally?

Thank you.

SOLVED: the resource folder under war was getting generated using eclipse compile only.I have created a source folder src/main/resources and moved all my resources package to it. Before it was under src/main/java. Now it works..! I can compile from terminal and run.


回答1:


Are you running the project via Maven (mvn test -Ptest-html) or as GWT project (mvn gwt:run)?

The first case should work if your path is set correctly, but running it as a GWT project has always failed for me.

I also suggest doing a mvn clean install, and seeing which resources are contained within your .war file. Your .nocache.js file should be in there, if not, you probably have a bigger issue (incorrect project setup).

Update:

Seeing as you don't have the .nocache.js file in your war something is wrong with your Maven configuration. See if the following config has been added to your HTML pom in your plugins tags:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>prepare-package</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Either way, your HTML version won't run until you see the .nocache.js in your war file. Double-check your Maven configuration with a new PlayN project, and see where there are differences.



来源:https://stackoverflow.com/questions/10227126/how-to-resolve-the-playn-asset-path-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!