0
votes

I'm new to Liferay, so I started with the tutorials on the official developer website (https://dev.liferay.com/develop/learning-paths/mvc/-/knowledge_base/6-2/writing-your-first-liferay-application).

When I create my first portlet I'm getting the Build Failed error below:

Buildfile: E:\phmathieu\liferay-plugins-sdk-6.2\portlets\build.xml
  [get] Getting: http://mirrors.lax.liferay.com/cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
  [get] To: C:\Users\TEMP\.liferay\mirrors\cdn.repository.liferay.com\nexus\content\repositories\liferay-snapshots-ce\com\liferay\org.apache.ivy\2.4.0.LIFERAY-PATCHED-1-SNAPSHOT\org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
  [get] Error getting http://mirrors.lax.liferay.com/cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar to C:\Users\TEMP\.liferay\mirrors\cdn.repository.liferay.com\nexus\content\repositories\liferay-snapshots-ce\com\liferay\org.apache.ivy\2.4.0.LIFERAY-PATCHED-1-SNAPSHOT\org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
  [get] Getting: http://cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
  [get] To: C:\Users\TEMP\.liferay\mirrors\cdn.repository.liferay.com\nexus\content\repositories\liferay-snapshots-ce\com\liferay\org.apache.ivy\2.4.0.LIFERAY-PATCHED-1-SNAPSHOT\org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
  [get] Error getting http://cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar to C:\Users\TEMP\.liferay\mirrors\cdn.repository.liferay.com\nexus\content\repositories\liferay-snapshots-ce\com\liferay\org.apache.ivy\2.4.0.LIFERAY-PATCHED-1-SNAPSHOT\org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar

BUILD FAILED

E:...\liferay-plugins-sdk-6.2\portlets\build.xml:5: The following error occurred while executing this line:

E:...\liferay-plugins-sdk-6.2\build-common-plugins.xml:5: The following error occurred while executing this line:

E:...\liferay-plugins-sdk-6.2\build-common.xml:60: The following error occurred while executing this line:

E:...\liferay-plugins-sdk-6.2\build-common-ivy.xml:130: The following error occurred while executing this line:

E:...\liferay-plugins-sdk-6.2\build-common-ivy.xml:81: java.net.ConnectException: Connection refused: connect

Total time: 1 second

I have no idea why I get this message since I basically followed the steps in the tutorial. I looked online for similar cases but it hasn't been helpful yet.

Edit:

What happens at line 81 in build-common-ivy.xml : (line 81 is the /> ending the second get)

                    <if>
                    <equals arg1="@{trylocalnetwork}" arg2="true" />
                    <then>
                        <trycatch>
                            <try>
                                <get
                                    dest="${mirrors.cache.artifact.dir}"
                                    ignoreerrors="@{ignoreerrors}"
                                    src="${mirrors.src}"
                                    verbose="@{verbose}"
                                />
                            </try>
                            <catch>
                                <get
                                    dest="${mirrors.cache.artifact.dir}"
                                    ignoreerrors="@{ignoreerrors}"
                                    src="@{src}"
                                    verbose="@{verbose}"
                                />
                            </catch>
                        </trycatch>
                    </then>
                    <else>
                        <get
                            dest="${mirrors.cache.artifact.dir}"
                            ignoreerrors="@{ignoreerrors}"
                            src="@{src}"
                            verbose="@{verbose}"
                        />
                    </else>
                </if>
1
What happens in liferay-plugins-sdk-6.2\build-common-ivy.xml at line 81? I guess a server is contacted to fetch dependent jars. The server may be down at the moment, the project repo that is contacted may have been moved or one several other problems may have arised (network problems, dns problems ...)blafasel
@blafasel : I've edited my first post yith the code, since it was too long to post it as a commentPierreH
Why not use the eclipse plugin? Regarding your ivy issue(if you want to follow that path) are you behind a proxy?jstuartmilne
@Sudakatux : What do you mean?PierreH
The first time you run Liferay SDK it will connect to the central repository and download all the dependency to your local so it will take time to download dependencies for first time. If you are not connected to internet this will not work, or if you stop the first build it will no longer work.Mustapha Aoussar

1 Answers

0
votes

I use two ways to create a Lifery project. Going the Easy path

Download needed stuff

Download The Liferay IDE or Eclipse plugin from here

https://www.liferay.com/downloads/liferay-projects/liferay-ide

Download the SDK or the whole plugins (i prefer this last option)

https://github.com/liferay/liferay-plugins/releases

Pick the one matching your Liferay

When you open liferay IDE it will ask for your SDK. Put the sdk path (or the plugins folder)

Creating a project

Just go to new Liferay Project, and select the Type of project. Personally I always go for maven project.

Then you should be good to go

Bit More Complicated Way

Go to the extracted plugins path to the portlet folder (if your intent is a porlet) and call the create.sh command

liferay-plugins-6.2.0-ga1/portlets$ ./create.sh myPortlet
Buildfile: /home/jimmy/Liferays/plugins-src/liferay-plugins-6.2.0-ga1/portlets/build.xml

create:
     [copy] Copying 9 files to /home/jimmy/Liferays/plugins-src/liferay-plugins-6.2.0-ga1/portlets/myPortlet-portlet
    [mkdir] Created dir: /home/jimmy/Liferays/plugins-src/liferay-plugins-6.2.0-ga1/portlets/myPortlet-portlet/docroot/WEB-INF/tld
     [copy] Copying 7 files to /home/jimmy/Liferays/plugins-src/liferay-plugins-6.2.0-ga1/portlets/myPortlet-portlet/docroot/WEB-INF/tld

BUILD SUCCESSFUL
Total time: 1 second

Then import that to your favourite ide, Since you have many plugins you can use that as a reference for you custom portlets.

Hope it helps