掲示板

Extend Social Office Contacts Portlet

9年前 に Jürgen Ulrich によって更新されました。

Extend Social Office Contacts Portlet

New Member 投稿: 2 参加年月日: 14/11/06 最新の投稿
Hi there,

I'm new to liferay and I want to extend the Contacts Portlet to display the company name of a portal member in the search result instead of the mail.
For extending portlets I've just found the document Creating Plugins to extend Plugins which describe the way via ANT. But what is the correct way to extend portlets via a maven?

To achieve this I've added the Contacts Portlet to my Nexus, created a maven portlet and added the war to my dependencies.
Via maven-war-plugin and the overlays I push my custom code to the war file.


...
<plugin>
	<groupid>org.apache.maven.plugins</groupid>
	<artifactid>maven-war-plugin</artifactid>
	<version>2.4</version>
	<configuration>
		<overlays>
			<overlay>
				<groupid>com.liferay</groupid>
				<artifactid>contacts-portlet</artifactid>
			</overlay>
		</overlays>
		<packagingexcludes>**/.sass-cache/**</packagingexcludes>
	</configuration>
</plugin>
...



...
<dependency>
	<groupid>com.liferay</groupid>
	<artifactid>contacts-portlet</artifactid>
	<version>${liferay.version}</version>
	<type>war</type>
	<scope>provided</scope>
</dependency>
...



This is working fine for JSPs, CSS and JS. But when I try to extend for example the ContactsCenterPortlet Class I'm missing some classes. So I tried to generate a JAR file for the Contacts Portlet code and added that to my Nexus and also to my maven project dependencies.

Is this the correct way to extend a portlet via maven portlet?

Thanks in advance!

Best Regards
Jürgen
9年前 に Jürgen Ulrich によって更新されました。

RE: Extend Social Office Contacts Portlet

New Member 投稿: 2 参加年月日: 14/11/06 最新の投稿
I also had to add the contacts-shared.jar and contacts-service.jar to the Nexus and to my pom dependencies.
After adding the build-helper-maven-plugin to my pom.xml with the correct source folder, everything is working fine.

But when thinking about extending the service of the contacts portlet, I think I have also to copy the service.xml and the necessary classes to the new portlet to regenerate the service.

My actual pom.xml

<!--?xml version="1.0"?-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelversion>4.0.0</modelversion>
	<groupid>com.raysono</groupid>
	<artifactid>contacts-portlet</artifactid>
	<packaging>war</packaging>
	<name>contacts-center Portlet</name>
	<version>${liferay.version}</version>
	<build>
		<plugins>
			<plugin>
				<groupid>com.liferay.maven.plugins</groupid>
				<artifactid>liferay-maven-plugin</artifactid>
				<version>${liferay.maven.plugin.version}</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>build-css</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<autodeploydir>${liferay.auto.deploy.dir}</autodeploydir>
					<appserverdeploydir>${liferay.app.server.deploy.dir}</appserverdeploydir>
					<appserverlibglobaldir>${liferay.app.server.lib.global.dir}</appserverlibglobaldir>
					<appserverportaldir>${liferay.app.server.portal.dir}</appserverportaldir>
					<liferayversion>${liferay.version}</liferayversion>
					<plugintype>portlet</plugintype>
				</configuration>
			</plugin>
			<plugin>
				<artifactid>maven-compiler-plugin</artifactid>
				<version>2.5</version>
				<configuration>
					<encoding>UTF-8</encoding>
					<source>1.7
					<target>1.7</target>
				</configuration>
			</plugin>
            <plugin>
                <groupid>org.codehaus.mojo</groupid>
                <artifactid>build-helper-maven-plugin</artifactid>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals><goal>add-source</goal></goals>
                        <configuration>
                            <sources>
                                <source>src/main/webapp/WEB-INF/src
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
			<plugin>
				<artifactid>maven-resources-plugin</artifactid>
				<version>2.5</version>
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
            <plugin>
                <groupid>org.apache.maven.plugins</groupid>
                <artifactid>maven-war-plugin</artifactid>
                <version>2.4</version>
                <configuration>
                    <overlays>
                        <overlay>
                            <groupid>com.liferay</groupid>
                            <artifactid>contacts-portlet</artifactid>
                        </overlay>
                    </overlays>
                    <packagingexcludes>**/.sass-cache/**</packagingexcludes>
                </configuration>
            </plugin>
		</plugins>
	</build>
	<dependencies>
        <dependency>
            <groupid>com.liferay</groupid>
            <artifactid>contacts-portlet</artifactid>
            <version>${liferay.version}</version>
            <type>war</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupid>com.liferay</groupid>
            <artifactid>contacts-portlet</artifactid>
            <version>${liferay.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupid>com.liferay</groupid>
            <artifactid>contacts-portlet-service</artifactid>
            <version>${liferay.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupid>com.liferay</groupid>
            <artifactid>contacts-portlet-shared</artifactid>
            <version>6.2.2</version>
            <scope>provided</scope>
        </dependency>

		<dependency>
			<groupid>com.liferay.portal</groupid>
			<artifactid>portal-service</artifactid>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>com.liferay.portal</groupid>
			<artifactid>util-bridges</artifactid>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>com.liferay.portal</groupid>
			<artifactid>util-taglib</artifactid>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>com.liferay.portal</groupid>
			<artifactid>util-java</artifactid>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>javax.portlet</groupid>
			<artifactid>portlet-api</artifactid>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>javax.servlet</groupid>
			<artifactid>servlet-api</artifactid>
			<version>2.4</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>javax.servlet.jsp</groupid>
			<artifactid>jsp-api</artifactid>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>
</project>


Is there anything terribly wrong?