Liferay 的编辑速度模板更改不显示或需要一段时间

发布于 2024-12-29 13:55:57 字数 2139 浏览 4 评论 0原文

我目前正在编辑我的 portal_normal.vm (server/tomcat/webapps/mytheme-theme/templates) 测试是否可以在该文件上写入并在浏览器上查看它。我尝试添加测试注释“”只是为了看看我是否真的可以在文件上写入。所以我刷新了文件,希望能看到我添加的评论,但没有。于是我继续刷新(ctrl+r),查看源代码将近二十分钟。一段时间后,当我再次尝试查看它时,它反映在我的源代码中。所以我认为它是由 Liferay 或我的浏览器缓存的。

所以我尝试调整评论添加版本(“<!-- test v2 -->”),希望看到变化。我在另一个浏览器上检查了它,评论没有更新或包含我添加的版本。所以我认为Liferay应对这个问题负责。

这是我的 portal-ext.properties 包含的内容:

auth.token.check.enabled=false

# Database settings
jdbc.default.jndi.name=jdbc/LiferayPool

#For removing captch
captcha.check.portal.create_account=false

session.enable.phishing.protection=false

default.regular.theme.id=my_site_WAR_my_theme

#Delete cookies while deleting session
session.enable.persistent.cookies=false

#redirecting null problem.
redirect.url.security.mode=mysite.com

journal.template.velocity.restricted.variables=

admin.email.from.name=Market.Travel Team
[email protected]

# Added because of the Error - No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
hibernate.current_session_context_class=thread

session.enable.url.with.session.id=false

和我的 portal-developer.properties

theme.css.fast.load=false
theme.images.fast.load=false

javascript.fast.load=true
javascript.log.enabled=true

layout.template.cache.enabled=false

browser.launcher.url=

combo.check.timestamp=true

freemarker.engine.cache.storage=soft:1
freemarker.engine.modification.check.interval=0

openoffice.cache.enabled=false

velocity.engine.resource.manager.cache.enabled=false

com.liferay.portal.servlet.filters.cache.CacheFilter=false

com.liferay.portal.servlet.filters.themepreview.ThemePreviewFilter=true

添加: 当我尝试编辑 css 文件时,我可以快速看到变化。只需重新加载一次,更改就会出现。我认为只是我的速度模板需要一些时间或者有问题。

Liferay版本: Liferay Portal Community Edition 6.0.6 CE

谢谢!

I'm currently editing my portal_normal.vm (server/tomcat/webapps/mytheme-theme/templates) testing if I can write on the file and see it on my browser. I tried putting a test comment "<!-- test -->" just to see if I can really write on the file. So I refreshed the file and hope I can see the comment I've added, but there we're none. So I continued refreshing (ctrl+r),\ and viewing the source code for almost an twenty minutes. After a while when I tried viewing it again it reflected in my source code. So I thought it was cached by either Liferay or my browser.

So I tried tweaking the comment adding version on it ("<!-- test v2 -->"), hoping to see changes. I checked it on another browser and the comment didn't update or include my added version. So I think Liferay is responsible for the issue.

this is what my portal-ext.properties contain:

auth.token.check.enabled=false

# Database settings
jdbc.default.jndi.name=jdbc/LiferayPool

#For removing captch
captcha.check.portal.create_account=false

session.enable.phishing.protection=false

default.regular.theme.id=my_site_WAR_my_theme

#Delete cookies while deleting session
session.enable.persistent.cookies=false

#redirecting null problem.
redirect.url.security.mode=mysite.com

journal.template.velocity.restricted.variables=

admin.email.from.name=Market.Travel Team
[email protected]

# Added because of the Error - No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
hibernate.current_session_context_class=thread

session.enable.url.with.session.id=false

and my portal-developer.properties

theme.css.fast.load=false
theme.images.fast.load=false

javascript.fast.load=true
javascript.log.enabled=true

layout.template.cache.enabled=false

browser.launcher.url=

combo.check.timestamp=true

freemarker.engine.cache.storage=soft:1
freemarker.engine.modification.check.interval=0

openoffice.cache.enabled=false

velocity.engine.resource.manager.cache.enabled=false

com.liferay.portal.servlet.filters.cache.CacheFilter=false

com.liferay.portal.servlet.filters.themepreview.ThemePreviewFilter=true

Addition: When I tried editing the css files I can see the changes fast. Just one reload the the changes appear. I think it is just in my velocity template that take some time or there's something wrong.

Liferay version: Liferay Portal Community Edition 6.0.6 CE

Thank You!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拔了角的鹿 2025-01-05 13:55:57

实际上没有必要定义自己的portal-developer.properties。通过将 -Dexternal-properties=portal-developer.properties 添加到 tomcat/bin/setenv.(sh|bat) 中的 JAVA_OPTS Liferay 将使用它的默认开发人员设置,该设置与您提供的几乎相同。但是,我不认为这有助于(或可以解决)您的问题。 更多详细信息请参见此处

如果您要更改正确的文件,开发人员属性确实允许您对模板进行实时更改。由于 Liferay 为部署的 Web 应用程序提供了默认的 context.xml,因此 Web 应用程序被复制/缓存在 tomcat/temp/{id}-webapp-name 中。这意味着,如果您更改 webapp/mytheme 中的模板,那么 tomcat 可能需要一段时间才能注意到更改(如果它注意到更改的话)(这取决于 tomcat 配置)。另一方面,如果您在 temp/1-mytheme 中进行更改,它将立即显示。编辑临时文件夹中的文件可能并不理想,因此...

如何解决此问题:(无特定顺序)

  • 防止 Tomcat 使用主题的临时目录。为您的主题创建一个 context.xml 文件。

    此文件应放置在您的 META-INF 文件夹中
    主题。如果您使用 Liferay 自动部署功能
    context.xml 文件可能已被破坏,此处此处。如果这个
    在这种情况下,您需要找到最适合您的解决方案
    需要,例如在部署主题后修改 context.xml。

  • 如果您使用 Liferay Plugin-SDK,您可以按照 快速插件开发指南用于设置您的开发环境。

There is really no need to define your own portal-developer.properties. By adding -Dexternal-properties=portal-developer.properties to your JAVA_OPTS in tomcat/bin/setenv.(sh|bat) Liferay will use it's default developer settings, which are almost identical to what you have provided. However, I do not believe this is contributes to (or could resolve) your problem. More details here.

The developer properties do allow you to make live changes to the templates provided you are changing the right file. Due to the default context.xml Liferay provides to the deployed webapps, the webapps are copied/cached in tomcat/temp/{id}-webapp-name. This means if you change the template in webapp/mytheme then it may take tomcat a while to pick up on the change, if it notices the change at all (this will depend on the tomcat configuration). On the other hand, if you make a change in temp/1-mytheme it will show up immediately. Editing the files in the temp folder is probably not ideal, so...

How to fix this: (no specific order)

  • Prevent Tomcat from using the temp directory for your theme. Create a context.xml file for your theme.

    <Context cachingAllowed="false"/>

    This file should be placed in the META-INF folder of your
    theme. If you are using the Liferay auto-deploy feature the
    context.xml file may be clobbered, here, and here. If this
    is the case you will need to find a work around that best suits your
    needs, such as modifying the context.xml after the theme is deployed.

  • If you are using the Liferay Plugin-SDK the you can follow the fast plugin development guide for setting up your development environment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文