如何解决playN资产路径错误? [英] How to resolve the playN asset path error?

查看:100
本文介绍了如何解决playN资产路径错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



找不到为/myproject/myproject.nocache.js找到的文件

另外,我在浏览器中只显示黑屏。



在MyProjectHtml.java文件中,我将路径



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



如何解决这个问题。我没有找到名称为nocache的任何文件。



注意:我之前问题答案中的评论将会很有用:

谢谢。
$ b 解决:战争中的资源文件夹是使用eclipse编译生成的。我创建了一个源文件夹src / main / resources,并将所有资源包移动到它。在src / main / java之前。现在它的作品..!我可以从终端进行编译并运行。

您是通过 Maven c $ c> mvn test -Ptest-html )或 GWT项目 mvn gwt:run )?



如果您的路径设置正确,则第一种情况应该可行,但将其作为GWT项目运行对我而言始终失败。



我还建议做一个 mvn clean install ,并查看哪些资源包含在 .war 文件中。你的 .nocache.js 文件应该在那里,如果没有,你可能有更大的问题(不正确的项目设置)。



更新:



由于您没有 .nocache.js war 您的Maven配置有问题。看看下面的配置是否已经添加到您的插件标签中的HTML POM:

 < plugin> 
< groupId> org.codehaus.mojo< / groupId>
< artifactId> gwt-maven-plugin< / artifactId>
<执行次数>
<执行>
<阶段>准备包< /阶段>
<目标>
< goal>编译< / goal>
< /目标>
< /执行>
< /执行次数>
< / plugin>

不管怎样,只有在看到时,HTML版本才会运行。 nocache.js war 文件中。用新的PlayN项目仔细检查你的Maven配置,看看有什么区别。


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.

解决方案

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.

这篇关于如何解决playN资产路径错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆