尝试制作CRUD portlet时,我遇到了Service Builder的问题。
首先,我创建了一个项目和Liferay portlet("这是在视图模式下的bla-bla-bla")。之后我创建了new->new Service Builder
xml文件。
我在那里插入了以下代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="com.proliferay.sbuilder">
<author>Alexandr</author>
<namespace>crudportlet</namespace>
<entity name="Book" table="BOOK_PORTLET" local-service="true" remote-service="true">
<column name="bookId" type="long" primary="true" id-type="increment"/>
<column name="bookName" type="String" />
<column name="description" type="String" />
<column name="authorName" type="String" />
<column name="isbn" type="int" />
<column name="price" type="int" />
</entity>
接下来,我点击了overview
标签,然后按了Build Service
按钮。 5秒后我得到HTTP Authorization failure
错误。 经过5小时的谷歌搜索和堆栈溢出后,我得出结论来评论这一行
#ivy.jar.url=http://cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/${ivy.version}/org.apache.ivy-${ivy.version}.jar
并粘贴此行
ivy.jar.url=https://repository.liferay.com/nexus/content/repositories/liferay-public-snapshots/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/
正如他们在build.Sasha.properties
文件中的其他主题中所说的那样。但我现在的错误是:
Unable to obtain resource from D:\LiferayWorkSpace\liferay-plugins-sdk- 6.2\.ivy\ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar: java.util.zip.ZipException: error in opening zip file
[taskdef] Unable to obtain resource from D:\LiferayWorkSpace\liferay-plugins-sdk-6.2\.ivy\ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar:
...
[taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found.
BUILD FAILED
我该怎么办?请帮我!我应该怎么做才能使用Service Builder创建最简单的CRUD portlet?
我使用Liferay 6.2 GA5,sdk 6.2。
我的build.xml文件:
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="CRUD-portlet" basedir="." default="deploy">
<import file="../build-common-portlet.xml" />
<property file="build.properties"/>
</project>
答案 0 :(得分:2)
它似乎是一个损坏的jar文件。 希望您尝试删除有问题的jar文件并使用干净的下载重建?尝试从给定路径手动下载jar org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar并放入相应的文件夹并重建您的服务
答案 1 :(得分:0)
哦,真是太容易了!
要解决这个问题,我们应该
替换这一行: ivy.jar.url = http://cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/ $ {ivy.version} /org.apache.ivy - $ {ivy.version}的.jar 对此:
ivy.jar.url=http://cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/${ivy.version}/org.apache.ivy-${ivy.version}.jar