Liferay ext插件——在util java中重写java类

Liferay ext插件——在util java中重写java类,liferay,Liferay,我需要覆盖/util java/src/com/liferay/util/Normalizer.java 我在上面找到了密码 我跟着做,能把蚂蚁清理干净 我读 将my.java文件放入我的ext plugin/docroot/WEB-INF/ext util java/com/liferay/util/Normalizer.java 蚁群 我知道正确的方法是创建Normalizer.java的子级并覆盖那些私有方法,但我想知道这些文件应该放在哪里 我很惊讶你能找到的关于这件事的信息如此之少。所有

我需要覆盖/util java/src/com/liferay/util/Normalizer.java

我在上面找到了密码

我跟着做,能把蚂蚁清理干净

我读

将my.java文件放入我的ext plugin/docroot/WEB-INF/ext util java/com/liferay/util/Normalizer.java

蚁群

我知道正确的方法是创建Normalizer.java的子级并覆盖那些私有方法,但我想知道这些文件应该放在哪里

我很惊讶你能找到的关于这件事的信息如此之少。所有的Liferay大师都表现得很简单。但事实并非如此

更新

buld.username.properties

    app.server.dir = /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23
    ext.work.dir = /liferay/bundles
    app.server.zip = /liferay/portal/liferay-portal-tomcat-6.1.0-ce-ga1.zip
更新2

我创建了ext-service/src文件夹,并获得了构建成功的奖励

ant编译和ant部署正在工作

url redirect fix ext是我的ext插件的名称

[root@localhost url-redirect-fix-ext]# ant deploy
Buildfile: /liferay/plugins/liferay-plugins-sdk-6.1.0-ce-ga1/ext/url-redirect-fix-ext/build.xml

compile:

compile-with-global-class-loader:

compile-java:

compile-with-portal-class-loader:

compile-java:

compile-with-portal-class-loader:

compile-java:

compile-with-portal-class-loader:

compile-java:

compile-with-portal-class-loader:

compile-java:

war:

war-util:

war-util:

war-util:
   [delete] Deleting: /liferay/plugins/liferay-plugins-sdk-6.1.0-ce-ga1/dist/url-redirect-fix-ext-6.1.0.1.war
      [zip] Building zip: /liferay/plugins/liferay-plugins-sdk-6.1.0-ce-ga1/dist/url-redirect-fix-ext-6.1.0.1.war
   [delete] Deleting: /liferay/plugins/liferay-plugins-sdk-6.1.0-ce-ga1/ext/url-redirect-fix-ext/docroot/WEB-INF/ext-url-redirect-fix-ext.xml

deploy:
     [copy] Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/deploy

BUILD SUCCESSFUL
但ant deploy不工作

[root@localhost url-redirect-fix-ext]# ant build
Buildfile: /liferay/plugins/liferay-plugins-sdk-6.1.0-ce-ga1/ext/url-redirect-fix-ext
/build.xml

BUILD FAILED
Target "build" does not exist in the project "url-redirect-fix-ext". 
我按照说明部署了插件,然后重新启动了服务器

这是我的Tomcat日志。我猜插件部署成功了

15:36:18,815 INFO  [AutoDeployDir:167] Processing url-redirect-fix-ext-6.1.0.1.war
15:36:18,818 INFO  [ExtAutoDeployListener:43] Copying extension environment plugin for /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/deploy/url-redirect-fix-ext-6.1.0.1.war
  Expanding: /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/deploy/url-redirect-fix-ext-6.1.0.1.war into /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF/classes
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF/classes
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy/dependencies/ext-url-redirect-fix-ext-util-bridges.jar modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy/dependencies/ext-url-redirect-fix-ext-util-java.jar modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy/dependencies/ext-url-redirect-fix-ext-util-taglib.jar modified in the future.
  Warning: WEB-INF/ext-impl/ext-impl.jar modified in the future.
  Warning: WEB-INF/ext-service/ext-service.jar modified in the future.
  Warning: WEB-INF/ext-util-bridges/ext-util-bridges.jar modified in the future.
  Warning: WEB-INF/ext-util-java/ext-util-java.jar modified in the future.
  Warning: WEB-INF/ext-util-taglib/ext-util-taglib.jar modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/liferay-portlet-ext.xml modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/portlet-ext.xml modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/tiles-defs-ext.xml modified in the future.
  Warning: WEB-INF/liferay-plugin-package.properties modified in the future.
  Warning: WEB-INF/ext-impl/classes modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy modified in the future.
  Warning: WEB-INF/ext-impl/src modified in the future.
  Warning: WEB-INF/ext-lib modified in the future.
  Warning: WEB-INF/ext-lib/global modified in the future.
  Warning: WEB-INF/ext-lib/portal modified in the future.
  Warning: WEB-INF/ext-service/classes modified in the future.
  Warning: WEB-INF/ext-service/src modified in the future.
  Warning: WEB-INF/ext-util-bridges modified in the future.
  Warning: WEB-INF/ext-util-bridges/classes modified in the future.
  Warning: WEB-INF/ext-util-bridges/src modified in the future.
  Warning: WEB-INF/ext-util-java modified in the future.
  Warning: WEB-INF/ext-util-java/classes modified in the future.
  Warning: WEB-INF/ext-util-java/com modified in the future.
  Warning: WEB-INF/ext-util-java/com/liferay modified in the future.
  Warning: WEB-INF/ext-util-java/com/liferay/util modified in the future.
  Warning: WEB-INF/ext-util-java/src modified in the future.
  Warning: WEB-INF/ext-util-taglib modified in the future.
  Warning: WEB-INF/ext-util-taglib/classes modified in the future.
  Warning: WEB-INF/ext-util-taglib/src modified in the future.
  Warning: WEB-INF/ext-web modified in the future.
  Warning: WEB-INF/ext-web/docroot modified in the future.
  Copying 8 files to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/webapps/url-redirect-fix-ext
  Copying 2 files to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/webapps/url-redirect-fix-ext
  Deleting directory /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829
15:36:19,062 INFO  [ExtAutoDeployListener:50] Extension environment for /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/deploy/url-redirect-fix-ext-6.1.0.1.war copied successfully. Deployment will start in a few seconds.
Jun 5, 2012 3:36:25 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Reloading context [/url-redirect-fix-ext]
15:36:25,612 INFO  [PluginPackageUtil:1099] Reading plugin package for url-redirect-fix-ext
15:36:25,618 INFO  [ExtHotDeployListener:226] Extension environment for url-redirect-fix-ext will not be undeployed
15:36:26,090 INFO  [PluginPackageUtil:1099] Reading plugin package for url-redirect-fix-ext
15:36:26,133 INFO  [ExtHotDeployListener:234] Registering extension environment for url-redirect-fix-ext
15:36:26,133 INFO  [ExtHotDeployListener:152] Extension environment for url-redirect-fix-ext has been applied.
不工作。我的门户中仍有bug。

所以我在Git上找到的解决方案没有处理我的bug 或者新的Normalizer.java没有覆盖旧的Normalizer.class

我怎么能确定

更新3

蚂蚁部署


您从util java更改代码,但将其放入util桥中?试着把它放在extutiljava中。似乎没有涉及调用此函数的spring autowiring,并且该类中只有静态方法,因此您可能只需要复制现有代码并根据需要对其进行修补,然后进行编译

编辑/添加:

从错误消息中可以看出,您似乎过于严格地遵循了以下段落:

提示:创建Ext插件后,删除由添加的所有文件 扩展不需要的默认值。这很重要 因为Liferay跟踪每个Ext插件部署的文件 如果两个Ext插件覆盖了同一个插件,它就不允许部署它们 文件以避免冲突。通过删除任何不必要的文件 从一个ext插件,它将更容易与其他ext一起使用 插件

您应该只删除插件中不需要的文件,而不是目录。你说的错误信息说

规范化程序ext/docroot/WEB-INF/ext-service/src不存在

编辑2:

在最近的编辑中,您说“ant deploy”不起作用,但您实际执行的命令是“ant build”-ant抱怨没有找到“build”目标。请使用“ant deploy”重试

编辑3:

这与其说是问答,不如说是一个交互式调试会话:-)


您可以有任意多个ext插件,但每个文件只能在一个ext插件中被覆盖(包含)。错误消息告诉您出了什么问题:生成过程抱怨的文件是从不同的ext插件修改的。这就是为什么引用(见上面我的答案中的“提示”部分)说要从插件中删除文件,除非你真的需要&覆盖它们。构建过程抱怨的文件正是create脚本自动启动ext插件所使用的文件。

您从util java更改代码,但将其放入util桥?试着把它放在extutiljava中。似乎没有涉及调用此函数的spring autowiring,并且该类中只有静态方法,因此您可能只需要复制现有代码并根据需要对其进行修补,然后进行编译

编辑/添加:

从错误消息中可以看出,您似乎过于严格地遵循了以下段落:

提示:创建Ext插件后,删除由添加的所有文件 扩展不需要的默认值。这很重要 因为Liferay跟踪每个Ext插件部署的文件 如果两个Ext插件覆盖了同一个插件,它就不允许部署它们 文件以避免冲突。通过删除任何不必要的文件 从一个ext插件,它将更容易与其他ext一起使用 插件

您应该只删除插件中不需要的文件,而不是目录。你说的错误信息说

规范化程序ext/docroot/WEB-INF/ext-service/src不存在

编辑2:

在最近的编辑中,您说“ant deploy”不起作用,但您实际执行的命令是“ant build”-ant抱怨没有找到“build”目标。请使用“ant deploy”重试

编辑3:

这与其说是问答,不如说是一个交互式调试会话:-)


您可以有任意多个ext插件,但每个文件只能在一个ext插件中被覆盖(包含)。错误消息告诉您出了什么问题:生成过程抱怨的文件是从不同的ext插件修改的。这就是为什么引用(见上面我的答案中的“提示”部分)说要从插件中删除文件,除非你真的需要&覆盖它们。生成过程抱怨的文件正是创建脚本自动启动ext插件所使用的文件。

您好,您是否在/my ext plugin/>上尝试过“ant compile”?@FelixChristy感谢您的回复。是的。获得了与ant buid相同的输出。我想我应该把Normalizer.java放到一个propper位置并添加一些属性。看起来Liferay找不到我的zip文件。我仔细检查了我的属性。找不到问题。请检查问题中的属性。我编辑了该问题以回答您对我的答案的评论。请确保这与您的实际设置相符。(同时看看我对我的答案的编辑)嗨,你在你的/my ext plugin/>上试过“ant compile”吗?@FelixChristy谢谢你的回复。是的。获得了与ant buid相同的输出。我想我应该把Normalizer.java放到一个propper位置并添加一些属性
15:36:18,815 INFO  [AutoDeployDir:167] Processing url-redirect-fix-ext-6.1.0.1.war
15:36:18,818 INFO  [ExtAutoDeployListener:43] Copying extension environment plugin for /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/deploy/url-redirect-fix-ext-6.1.0.1.war
  Expanding: /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/deploy/url-redirect-fix-ext-6.1.0.1.war into /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF/classes
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF/classes
  Copying 1 file to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829/WEB-INF
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy/dependencies/ext-url-redirect-fix-ext-util-bridges.jar modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy/dependencies/ext-url-redirect-fix-ext-util-java.jar modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy/dependencies/ext-url-redirect-fix-ext-util-taglib.jar modified in the future.
  Warning: WEB-INF/ext-impl/ext-impl.jar modified in the future.
  Warning: WEB-INF/ext-service/ext-service.jar modified in the future.
  Warning: WEB-INF/ext-util-bridges/ext-util-bridges.jar modified in the future.
  Warning: WEB-INF/ext-util-java/ext-util-java.jar modified in the future.
  Warning: WEB-INF/ext-util-taglib/ext-util-taglib.jar modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/liferay-portlet-ext.xml modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/portlet-ext.xml modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml modified in the future.
  Warning: WEB-INF/ext-web/docroot/WEB-INF/tiles-defs-ext.xml modified in the future.
  Warning: WEB-INF/liferay-plugin-package.properties modified in the future.
  Warning: WEB-INF/ext-impl/classes modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal modified in the future.
  Warning: WEB-INF/ext-impl/classes/com/liferay/portal/deploy modified in the future.
  Warning: WEB-INF/ext-impl/src modified in the future.
  Warning: WEB-INF/ext-lib modified in the future.
  Warning: WEB-INF/ext-lib/global modified in the future.
  Warning: WEB-INF/ext-lib/portal modified in the future.
  Warning: WEB-INF/ext-service/classes modified in the future.
  Warning: WEB-INF/ext-service/src modified in the future.
  Warning: WEB-INF/ext-util-bridges modified in the future.
  Warning: WEB-INF/ext-util-bridges/classes modified in the future.
  Warning: WEB-INF/ext-util-bridges/src modified in the future.
  Warning: WEB-INF/ext-util-java modified in the future.
  Warning: WEB-INF/ext-util-java/classes modified in the future.
  Warning: WEB-INF/ext-util-java/com modified in the future.
  Warning: WEB-INF/ext-util-java/com/liferay modified in the future.
  Warning: WEB-INF/ext-util-java/com/liferay/util modified in the future.
  Warning: WEB-INF/ext-util-java/src modified in the future.
  Warning: WEB-INF/ext-util-taglib modified in the future.
  Warning: WEB-INF/ext-util-taglib/classes modified in the future.
  Warning: WEB-INF/ext-util-taglib/src modified in the future.
  Warning: WEB-INF/ext-web modified in the future.
  Warning: WEB-INF/ext-web/docroot modified in the future.
  Copying 8 files to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/webapps/url-redirect-fix-ext
  Copying 2 files to /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/webapps/url-redirect-fix-ext
  Deleting directory /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/tomcat-7.0.23/temp/20120605153618829
15:36:19,062 INFO  [ExtAutoDeployListener:50] Extension environment for /liferay/bundles/liferay-portal-6.1.0-ce-ga1-new/deploy/url-redirect-fix-ext-6.1.0.1.war copied successfully. Deployment will start in a few seconds.
Jun 5, 2012 3:36:25 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Reloading context [/url-redirect-fix-ext]
15:36:25,612 INFO  [PluginPackageUtil:1099] Reading plugin package for url-redirect-fix-ext
15:36:25,618 INFO  [ExtHotDeployListener:226] Extension environment for url-redirect-fix-ext will not be undeployed
15:36:26,090 INFO  [PluginPackageUtil:1099] Reading plugin package for url-redirect-fix-ext
15:36:26,133 INFO  [ExtHotDeployListener:234] Registering extension environment for url-redirect-fix-ext
15:36:26,133 INFO  [ExtHotDeployListener:152] Extension environment for url-redirect-fix-ext has been applied.
ERROR [ExtHotDeployListener:189] Extension environment for normalizer-ext cannot be applied because of detected conflicts:
url-redirect-fix-ext:
    ext-util-java/com/liferay/util/Normalizer.java
    ext-web/docroot/WEB-INF/liferay-portlet-ext.xml
    ext-web/docroot/WEB-INF/portlet-ext.xml
    ext-web/docroot/WEB-INF/struts-config-ext.xml
    ext-web/docroot/WEB-INF/tiles-defs-ext.xml
    ext-web/docroot/WEB-INF/web.xml