Uploaded image for project: 'PUBLIC - Liferay Maven'
  1. PUBLIC - Liferay Maven
  2. MAVEN-217

Interpolation of system properties not working for pom imports

    Details

    • Type: Bug
    • Status: Contributed Solution
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 6.2.0 GA1, 6.2.X
    • Fix Version/s: None
    • Component/s: Plugins
    • Labels:
      None

      Description

      Maven's interpolatation of system properties is not working, if the liferay-maven-plugin is used for a plugin project with some dependencies that a using pom imports.

      We have developed some porlets, that are using EJB calls to a JBoss server. During the migration to EAP6.2 we ran into some problems, because we switched to JBoss' jboss-as-ejb-client-bom. We are importing the mentioned bom into a client side jar, and that jar is defined as a dependency in the portlet. When calling the build-css target of the liferay-maven-plugin, the following exception is thrown:

      [ERROR] Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.10.15:build-css (liferay build-css) on project sample-app-portlet: Some problems were encountered while processing the POMs:
      [ERROR] [ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${java.home}/../lib/tools.jar @ org.jboss.as:jboss-as-parent:7.4.3.Final-redhat-2, C:\anw_entw\repos\org\jboss\as\jboss-as-parent\7.4.3.Final-redhat-2\jboss-as-parent-7.4.3.Final-redhat-2.pom, line 847, column 21: 1 problem was encountered while building the effective model for de.hansemerkur.frickeo:sample-app-jboss:0.0.1-SNAPSHOT
      [ERROR] [ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${java.home}/../lib/tools.jar @ org.jboss.as:jboss-as-parent:7.4.3.Final-redhat-2, C:\anw_entw\repos\org\jboss\as\jboss-as-parent\7.4.3.Final-redhat-2\jboss-as-parent-7.4.3.Final-redhat-2.pom, line 847, column 21
      [ERROR] -> [Help 1]
      

      I have debugged the maven code and found out, that the system property java.home is used in jboss-as-parent, but that it can not be resolved when building the dependency tree for the portlet plugin.

      This issue can be resolved by adding the following lines of code to the method AbstractToolsLiferayMojo#resolveProject:

      		projectBuildingRequest.setUserProperties(
      				mavenExecutionRequest.getUserProperties());
      		projectBuildingRequest.setSystemProperties(
      				mavenExecutionRequest.getSystemProperties());
      

      To reproduce the issue, you can use the attached multi-project maven project. Just unpack the zip, switch into the sample-app folder and call mvn validate.

      The project contains one module sample-app-jboss that defines a jar file with a managed dependency to jboss. The second module sample-app-jboss contains the portlet with a dependency to the first module. The liferay-maven-plugin is connected to the validate phase.

      Obviously, the central repository of maven must be reachable to download the dependencies. The first call will take some time, since the liferay-maven-plugin will download and unpack the portal-web application first.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                3 years, 23 weeks, 5 days ago

                Packages

                Version Package