Search code examples
javaliferayportlet

Liferay 6.2 first application build failed


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>

Solution

  • 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