1

我在尝试制作 CRUD portlet 时遇到了 Service Builder 的问题。

首先,我创建了一个项目和 Liferay portlet("This is bla-bla-bla in view mode")。之后,我创建了new->new Service Builderxml 文件。我在那里插入了以下代码:

<?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 个小时的谷歌搜索和 stackoverflow,我得出结论来评论这一行

#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>

截图 1

截图 2

截图 3

4

2 回答 2

2

它似乎是一个损坏的 jar 文件。希望您尝试删除有问题的 jar 文件并通过干净的下载重新构建?尝试从给定路径手动下载 jar org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar 并放入相应的文件夹中并重建您的服务

于 2016-08-09T17:14:46.270 回答
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
于 2016-08-10T11:10:58.480 回答