Foren

maven pom with reference to global classpath 2nd db service jar

thumbnail
Jack Bakker, geändert vor 9 Jahren.

maven pom with reference to global classpath 2nd db service jar

Liferay Master Beiträge: 978 Beitrittsdatum: 03.01.10 Neueste Beiträge
OSGi is coming yes, cool, but in the meantime, I had to ramp up on maven while using a legacy approach of moving a service jar to global classpath, where service.xml and ext-spring.xml are devoted to a 2nd _biz_ sql database, where others in the 'Enterprise' have control over that db (including 'ids', and also having no auditing fields)

so, after creating, from maven, a service project (which looked weird at first with two modules, until I looked at/furthered it thru IntelliJ and midnight commander ; filesystem trees RULE), I hacked my way towards adding the following to any portlet pom that needs to reference the global service jar (while using a parent pom)

<dependency>
      <groupid>com.bizclient.server.services</groupid>
      <artifactid>bizclient-services</artifactid>
      <version>1</version>
      <scope>system</scope>
      <systempath>${liferay.app.server.lib.global.dir}/bizclient-services-portlet-service.jar</systempath>
</dependency>


I read that <scope>system</scope> with filesystem <systemPath/> is bad form from a maven perspective, and also moving service jar to global classpath is bad form according to liferay de facto best practices, but overall I still see need to make services to non-lportal datasources available globally .. at least until I get a grip of OSGi for v7
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: maven pom with reference to global classpath 2nd db service jar

Liferay Legend Beiträge: 14914 Beitrittsdatum: 02.09.06 Neueste Beiträge
You still can use the global service jar.

In your pom, just change from system to provided and remove the systemPath reference.

On the plugin that is providing the service, you have to do a "mvn install" to ensure the service jar is installed into the local repository and available for the other projects to use during compile time.

You still use the required-deployment-contexts in liferay-plugin-package.properties file to ensure your portlet loads after the plugin providing the service, but otherwise it is business as usual.
thumbnail
Jack Bakker, geändert vor 9 Jahren.

RE: maven pom with reference to global classpath 2nd db service jar

Liferay Master Beiträge: 978 Beitrittsdatum: 03.01.10 Neueste Beiträge
for globally placed bizclient monolithic service jar, I haven't needed to use required-deployment-contexts in liferay-plugin-package.properties

also I use Nexus

but thanks
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: maven pom with reference to global classpath 2nd db service jar

Liferay Legend Beiträge: 14914 Beitrittsdatum: 02.09.06 Neueste Beiträge
It is still best to list it as a required deployment context. Liferay loads alphabetically, so if you create a plugin that depends on the service bug starts with 'a', it will load before bizclient. Getting into the habit of using the required deployment context will ensure that the right thing always happens, regardless of load ordering.

With nexus, you can still do 'mvn install' to push locally or 'mvn deploy' to push into your nexus repo. Either way, it gets the service jar into the repo so your other dependent projects can use the service jar.