留言板

Liferay CE 7.0.0-GA3 Custom Theme With Maven Problems

Gilad Reich,修改在7 年前。

Liferay CE 7.0.0-GA3 Custom Theme With Maven Problems

New Member 帖子: 10 加入日期: 16-7-21 最近的帖子
Hello everyone,
I'm trying to create a custom theme from scratch using maven and having a hard time with the versions and dependencies due to the lack of documentation online and topics regarding building theme with maven in Liferay 7.
Checking liferay-portal-7.0.x source code, i've seen that most of the projects was build with gradel and the build in themes with gulp.
I've already already tested gulp and gradel and got a custom themes working in the portal, but in order to work with my team, i would like to build a new theme with Maven and it seems that there are no supported versions yet for the latest of Liferay?

I've tried already generating a theme through the Liferay IDE 3.0 by generating a new plugin as theme and it build the pom.xml a bit different from the way of building it from the commands with mvn archetype:generate.

The best state that I've gotten with the pom file so far, that no errors showing in Eclipse using Liferay IDE 3.0 and when i try to build it, it fires up a lot of messages such as "too many links" and it takes more than 20 minutes and then error building it.
<properties>
        <liferay.version>7.0.0-m2</liferay.version>
        <liferay.version.dependencies>7.0.0-nightly</liferay.version.dependencies>
</properties>


I made them separately, because the dependencies seems to use the nightly version and the portal using the m2.
So that's pretty much my problem and it would be much appreciated to hear some suggestion and solutions to how to get a proper versioning in order to get a custom team build with maven working on Liferay-CE-Portal-7.0-GA3 (if that's even supported atm).

I would like to get it into a state where i can properly build it with maven and starting finally working on the theme.
I'll write on the bottom my steps, just in case something is unclear, but of course, please don't hesitate to ask me questions in order to locate together the problem.

Regards,
Gilad
------------------------------------------------------------------------------------------------------------------------------------------------------------


Step 1:
Creating directory to generate the theme through the console using:
mvn archetype:generate

Step 2:
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 831: 238
Which is:
238: remote -> com.liferay.maven.archetypes:liferay-theme-archetype (Provides an archetype to create Liferay themes.)

Step 3:
Choose a number: 41: 41
Which is:
41: 7.0.0-m2
And it seems to be the latest version support by maven, because that's the list i get(deprecated the versions under 7):
40: 7.0.0-m1
41: 7.0.0-m2

Step 4:
Define value for property 'groupId': : com.company.project
Define value for property 'artifactId': : maven-liferay-theme
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  com.company.project: : 
Confirm properties configuration:
groupId: com.company.project
artifactId: maven-liferay-theme
version: 1.0-SNAPSHOT
package: com.company.project
 Y: : Y


[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: liferay-theme-archetype:7.0.0-m2
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.company.project
[INFO] Parameter: artifactId, Value: maven-liferay-theme
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.jkaref.owidi
[INFO] Parameter: packageInPathFormat, Value: com/company/project
[INFO] Parameter: package, Value: com.company.project
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.company.project
[INFO] Parameter: artifactId, Value: maven-liferay-theme
[INFO] project created from Archetype in dir: path
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:07 min
[INFO] Finished at: 2016-09-09T15:25:56+02:00
[INFO] Final Memory: 13M/98M
[INFO] ------------------------------------------------------------------------


Step 5:
Now that the project has been generated, starting to work on the pom.xml in order to get ride of the errors and correct the versions:
<!--?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.company.project</groupid>
    <artifactid>maven-liferay-theme</artifactid>
    <version>1.0x-SNAPSHOT</version>
    <name>maven-liferay-theme</name>
    <packaging>war</packaging>

	<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>theme-merge</goal>
							<goal>build-css</goal>
							<goal>build-thumbnail</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>
					<parenttheme>${liferay.theme.parent}</parenttheme>
					<plugintype>theme</plugintype>
					<themetype>${liferay.theme.type}</themetype>
				</configuration>
			</plugin>
			<plugin>
				<artifactid>maven-resources-plugin</artifactid>
				<version>2.5</version>
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
	
	<dependencies>
        <dependency>
            <groupid>com.liferay.portal</groupid>
            <artifactid>portal-service</artifactid>
            <version>${liferay.version.dependencies}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupid>com.liferay.portal</groupid>
            <artifactid>util-bridges</artifactid>
            <version>${liferay.version.dependencies}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupid>com.liferay.portal</groupid>
            <artifactid>util-taglib</artifactid>
            <version>${liferay.version.dependencies}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupid>com.liferay.portal</groupid>
            <artifactid>util-java</artifactid>
            <version>${liferay.version.dependencies}</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>

	<properties>
        <liferay.theme.parent>_styled</liferay.theme.parent>
        <liferay.theme.type>vm</liferay.theme.type>

        <project.build.java.source-version>1.8</project.build.java.source-version>
        <project.build.java.target-version>1.8</project.build.java.target-version>
        <project.build.sourceencoding>UTF-8</project.build.sourceencoding>
        <project.build.finalname>${project.artifactId}-${project.version}</project.build.finalname>

        <liferay.version>7.0.0-m2</liferay.version>
        <liferay.version.dependencies>7.0.0-nightly</liferay.version.dependencies>
        <liferay.auto.deploy.dir></liferay.auto.deploy.dir>
	</properties>
</project>
thumbnail
David H Nebinger,修改在7 年前。

RE: Liferay CE 7.0.0-GA3 Custom Theme With Maven Problems

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Hey, Gilad, you're a little bit ahead of the class...

Liferay is actually getting ready to release new maven templates for LR7 development that you'll be able to use to create LR7 plugins. I believe they're going to be out end of this week or next, but I'm not completely sure about the release date.

I do know that even when they are available, the theme template is not supposed to be one of them. I don't know why this is or when/if one might be available, but I would encourage you to use the provided Liferay dev tools to build out your theme, it will be much less work than trying to fit all of the changes to your current build process.

Please note that project templates for 6.x plugins can be used for some plugins but they will be deployed to Liferay in legacy mode. Because of this, some templates won't work to well as legacy mode may not support migration of every type of plugin.

The maven template for LR 6.x themes won't work at all, really.






Come meet me at the LSNA!
Gilad Reich,修改在7 年前。

RE: Liferay CE 7.0.0-GA3 Custom Theme With Maven Problems

New Member 帖子: 10 加入日期: 16-7-21 最近的帖子
Hey David,

I actually started working with the provided developer tools and experiencing on a custom theme atm, especially when
Robert Frampton just made a fix for gulp auto deploy functionality. I guess at some point I'll migrate that theme into a maven project.

Thanks for the informative answer! appreciate that and I'm really looking forward for maven releasing templates for Liferay 7.
thumbnail
David H Nebinger,修改在7 年前。

RE: Liferay CE 7.0.0-GA3 Custom Theme With Maven Problems

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
So the new templates being released will support the creation of the OSGi module types, not really for themes.

I don't really know if theme support will get some maven attention or not. The focus for theme tools have been to leverage those tools used by front end developers, not us backend guys.

I'd suggest starting to learn the 7.0 theme tools that are out now and work on building your theme with those.