如何更改Lift项目根包?
标准的“Symply Lift”RestHelper示例项目具有代码
, code.lib
和 code.model
和 bootstrap.liftweb.Boot
命名空间。我已将它们更改为 mycompany.myproject.code
e tc 现在,项目编译正常,Jetty 启动正常,但我得到 The Requested URL /my/url was not found on this server<当我尝试访问重构之前运行良好的内容时, /code> 出现错误。我可能忘记更改什么?我应该如何安全地更改包名称?
将 LiftRules.addToPackages("code")
更改为 LiftRules.addToPackages("mycompany.myproject.code")
没有帮助。
更新:我发现问题是由于我将 bootstrap.liftweb.Boot
移动到 mycompany.myproject.bootstrap.liftweb.Boot
引起的。我已经把它移回来了,它又可以正常工作了。但我仍然很好奇如何自定义 bootstrap.liftweb
位置,因为 bootstrap.liftweb.Boot
类因项目而异,我不希望所有项目都有相同的全名。
A standard "Symply Lift" RestHelper example project features code
, code.lib
and code.model
and bootstrap.liftweb.Boot
namespaces. I've changed those to mycompany.myproject.code
e t.c. Now the project compiles ok and Jetty starts just fine but I get The Requested URL /my/url was not found on this server
error when I try to access what used to work just fine before the refactoring. What may I have forgotten to change? How should I change the packages names safely?
Changing LiftRules.addToPackages("code")
to LiftRules.addToPackages("mycompany.myproject.code")
doesn't help.
UPDATE: I've found out that the problem was caused by the fact I've moved bootstrap.liftweb.Boot
to mycompany.myproject.bootstrap.liftweb.Boot
. I've moved it back and it is up and working again. But I am still curious how can I customize bootstrap.liftweb
location as bootstrap.liftweb.Boot
class differs from project to project and I don't want all of them to have the same full name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
web.xml
中的 LiftFilter 设置定义自己的Boot
类,如 探索 Lift 的第 3.2 章 Bootstrap。从书中:
您的自定义引导类必须子类化 net.liftweb.http.Bootable 并实现 boot 方法。
You can define your own
Boot
class using LiftFilter Setup inweb.xml
as described in Chapter 3.2 Bootstrap of Exploring Lift.From the book:
where your custom boot class class must subclass
net.liftweb.http.Bootable
and implement theboot
method.