我使用liferay的maven原型来生成这样的主题:
mvn archetype:generate \
-DarchetypeGroupId=com.liferay.maven.archetypes \
-DarchetypeArtifactId=liferay-theme-archetype \
-DarchetypeVersion=6.2.0
查看here以供参考。
奇怪的是,这个过程不会给我liferay-look-and-feel.xml
。
现在,因为我正在从Liferay 6.0迁移一个旧主题,所以我试图复制liferay-look-and-feel.xml
,采用新环境(即6.2):
<?xml version="1.0"?>
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.2.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_2_0.dtd">
<look-and-feel>
<compatibility>
<version>6.2.0+</version>
</compatibility>
<theme id="test-theme" name="Test Theme" />
</look-and-feel>
但是,mvn package
似乎根本不喜欢这个文件:
$ mvn package -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test-theme Theme 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- liferay-maven-plugin:6.2.0-RC5:theme-merge (default) @ test-theme ---
[INFO] Parent theme group ID com.liferay.portal
[INFO] Parent theme artifact ID portal-web
[INFO] Parent theme version 6.2.10-GA1
[INFO] Parent theme ID _styled
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.803s
[INFO] Finished at: Tue Feb 18 11:02:32 CET 2014
[INFO] Final Memory: 7M/244M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.0-RC5:theme-merge (default) on project test-theme: www.liferay.com Nested exception: www.liferay.com -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.0-RC5:theme-merge (default) on project test-theme: www.liferay.com Nested exception: www.liferay.com
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: www.liferay.com Nested exception: www.liferay.com
at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:82)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.dom4j.DocumentException: www.liferay.com Nested exception: www.liferay.com
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.dom4j.io.SAXReader.read(SAXReader.java:264)
at com.liferay.maven.plugins.util.SAXReaderUtil.read(SAXReaderUtil.java:30)
at com.liferay.maven.plugins.ThemeMergeMojo.doExecute(ThemeMergeMojo.java:141)
at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:75)
... 21 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
删除liferay-look-and-feel.xml
会给我我想要的结果,所以我问你:如果这个文件是必要的并且documented,那么为什么liferay maven插件有问题?
答案 0 :(得分:4)
您需要在pom.xml中添加以下条目。
<properties>
<liferay.theme.parent>classic</liferay.theme.parent>
<liferay.theme.type>vm</liferay.theme.type>
</properties>
根据您的要求,您可以将父主题设为_styled,_unstyled或classic。
在liferay-look-and-feel.xml中我们指定themeId,version等。 使用maven进行插件开发时,我们必须在pom.xml中指定这些值。所以不需要liferay-look-and-feel.xml