Message Boards

Building older version from sources

Jan Tošovský, modified 2 Years ago.

Building older version from sources

Liferay Master Posts: 566 Join Date: 7/22/10 Recent Posts

I'd like to fix one urgent issue in class located in portal-impl.jar in older 7.3.4-ga5 version. However, I am unable to build it from sources following the procedure in https://portal.liferay.dev/participate/fix-a-bug/building-liferay-source with these changes:

  • used liferay-binaries-cache-2020 repo instead of liferay-binaries-cache-2017
  • after cloning my fork of the liferay-portal repo I checked out the 7.3.4-ga5 tag
  • commented this target as ant cannot find some dependency (and this goal doesn't seem to be crucial for me)
    <target depends="jar,jar-sources" name="install-portal-snapshot">
    <!--
       <install-portal-artifact snapshot="true">
          <attach classifier="sources" file="${artifact.name}-sources.jar" />
       </install-portal-artifact>
    -->
    </target>

But once I run ant compile install-portal-snapshots, it fails when compiling Petra classes because of missing com.liferay.portal.kernel-10.0.0-SNAPSHOT.jar dependency. In 7.3.4 this jar was shipped in version 9.0.3. That 10.0.0-SNAPSHOT is specified in .gradle/gradle.properties, but my changes are always rewritten by a fresh version during the build.

  1. Is that build procedure applicable to old releases? If not, what is the better method?
  2. How can I overrride that gradle version of portal.kernel JAR?

 

 

 

Jan Tošovský, modified 2 Years ago.

RE: Building older version from sources (Answer)

Liferay Master Posts: 566 Join Date: 7/22/10 Recent Posts

I finally found the corresponding code in build-common.xml

I commented these lines

<!--
<record-artifact-version artifact.name="portal-impl" file="${gradle.properties.file}" />
<record-artifact-version artifact.name="portal-kernel" file="${gradle.properties.file}" />
<record-artifact-version artifact.name="portal-test" file="${gradle.properties.file}" />
<record-artifact-version artifact.name="util-bridges" file="${gradle.properties.file}" />
<record-artifact-version artifact.name="util-java" file="${gradle.properties.file}" />
<record-artifact-version artifact.name="util-taglib" file="${gradle.properties.file}" />
-->

and added these lines instead with hardcoded versions:

<propertyfile file="${gradle.properties.file}">
   <entry key="com.liferay.portal.impl.version" value="5.13.4" />
   <entry key="com.liferay.portal.kernel.version" value="9.0.3" />
   <entry key="com.liferay.portal.test.version" value="8.1.1" />
   <entry key="com.liferay.util.bridges.version" value="7.0.5" />
   <entry key="com.liferay.util.java.version" value="5.0.7" />
   <entry key="com.liferay.util.taglib.version" value="5.2.1" />
</propertyfile>

There was one extra change needed to build the portal-impl.jar artifact successfully.

In same build-common.xml file I had to comment these lines in the "install-portal-artifact" macro:

<!--
<artifact:install file="${artifact.name}.@{packaging}">
    <attach-files />
    <localRepository path="${build.repository.local.dir}" unless:blank="${build.repository.local.dir}" />
    <pom file="pom.xml" />
</artifact:install>
-->
That code requires some dependencies not available on my machine. Maybe it could be fixed easily, but as I found the only artifact I needed (portal-impl.jar) in the portal-impl directory, I was reluctant to invest more time to it.

thumbnail
Amaury Gz, modified 1 Year ago.

RE: Building older version from sources

New Member Posts: 2 Join Date: 5/9/20 Recent Posts

Hi, I hope this will help:

About the missing ant dependencies, adding the jacocoant.jar and maven-ant-tasks.jar into the /lib ant folder worked for me.

Then also I was having troubles trying to deploy an old version, using only "ant compile" the Bundle-Version in the bnd.bnd files had been upgraded by the gradle task: baseline. So, searching in the source code on GitHub I found out that in the build-common-java.xml file there is a condition that controls the execution of such task

<equals arg1="${baseline.jar.report.level}" arg2="off" />

The baseline.jar.report.level property was defined in the build.properties with the default value of persist

Then I created the build.myusername.properties file like the build.properties file says and added the line

baseline.jar.report.level=off

and using "ant compile deploy" the portal was created into the ../bundles directory with the expected versions.

 

Note: The Bundles versions are upgraded as described here because the plugin prepares the project for the next release.