创建我的第一个liferay portlet(maven),当我部署

时间:2017-02-19 08:59:58

标签: eclipse maven liferay portlet

我是liferay的新手,我创造了我的第一个liferay portlet!

Project

然而,当我右键点击我的项目并转到

Liferay> Maven> liferay的:部署

我收到此错误

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for com.liferay.portal:portal-service:jar must be a valid version but is '${liferay.version}'. @ line 55, column 13
[ERROR] 'dependencies.dependency.version' for com.liferay.portal:util-bridges:jar must be a valid version but is '${liferay.version}'. @ line 61, column 13
[ERROR] 'dependencies.dependency.version' for com.liferay.portal:util-taglib:jar must be a valid version but is '${liferay.version}'. @ line 67, column 13
[ERROR] 'dependencies.dependency.version' for com.liferay.portal:util-java:jar must be a valid version but is '${liferay.version}'. @ line 73, column 13
[ERROR] 'build.plugins.plugin.version' for com.liferay.maven.plugins:liferay-maven-plugin must be a valid version but is '${liferay.maven.plugin.version}'. @ line 15, column 14
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.example.plugins:try:1.0.0-SNAPSHOT (C:\Users\otaibit.ENDLAB\workspace\try\pom.xml) has 5 errors
[ERROR]     'dependencies.dependency.version' for com.liferay.portal:portal-service:jar must be a valid version but is '${liferay.version}'. @ line 55, column 13
[ERROR]     'dependencies.dependency.version' for com.liferay.portal:util-bridges:jar must be a valid version but is '${liferay.version}'. @ line 61, column 13
[ERROR]     'dependencies.dependency.version' for com.liferay.portal:util-taglib:jar must be a valid version but is '${liferay.version}'. @ line 67, column 13
[ERROR]     'dependencies.dependency.version' for com.liferay.portal:util-java:jar must be a valid version but is '${liferay.version}'. @ line 73, column 13
[ERROR]     'build.plugins.plugin.version' for com.liferay.maven.plugins:liferay-maven-plugin must be a valid version but is '${liferay.maven.plugin.version}'. @ line 15, column 14
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/ProjectBuildingException

2 个答案:

答案 0 :(得分:0)

这显然是以某种方式错过了${liferay.version}属性。您可以在父POM,pom或常规设置中设置它 - 它是全部well documented的完整示例父pom,链接到更多文档。

我知道不鼓励只是链接到这里的文档,但我相信这个答案将会另外提出另一个关于liferay-maven插件的更多配置的问题并反映出来这里的文档太多了。

答案 1 :(得分:0)

您需要创建Maven个人资料。 它应该在您的pom.xml或Maven / Settings / conf.xml

中定义

我的个人资料示例。

<profile>
<id>lr7</id>
<properties>
 <liferay.version>7.0.0</liferay.version>
 <liferay.maven.plugin.version>7.0.0</liferay.maven.plugin.version>
 <liferay.auto.deploy.dir>E:\lr-train\DXP\liferay-dxp-digital-enterprise-7.0-ga1\deploy</liferay.auto.deploy.dir>
 <liferay.app.server.deploy.dir>E:\lr-train\DXP\liferay-dxp-digital-enterprise-7.0-ga1\tomcat-8.0.32\webapps</liferay.app.server.deploy.dir>
 <liferay.app.server.lib.global.dir>E:\lr-train\DXP\liferay-dxp-digital-enterprise-7.0-ga1\tomcat-8.0.32\lib\ext</liferay.app.server.lib.global.dir>
 <liferay.app.server.portal.dir>E:\lr-train\DXP\liferay-dxp-digital-enterprise-7.0-ga1\tomcat-8.0.32\webapps\ROOT</liferay.app.server.portal.dir>
</properties>
</profile>

现在您可以在部署时指定配置文件 即mvn clean package liferay:deploy -PprofileName

或者您可以设置有效个人资料

<activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
  </activeProfiles>

即使在日食中,您也可以指定个人资料。 无论何时创建项目,您都需要指定配置文件

Eclipse提供了通过指定服务器或选择配置文件来创建的选项 此外,在单击maven项目时,您可以指定配置文件。 Selecting maven profile