-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 5.1.2, 5.2.3
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Branch Version/s:5.2.x, 5.1.x
-
Backported to Branch:Committed
This was created as a result of LPS-5203. Tomas Polesovsky showed a really cool idea of how to make the Ext environment smaller. His idea was to create an "extlet". The actual implementation uses many of the same ideas with slight changes.
We created a new plugin type called "ext". So besides portlets, themes, layout templates, and hooks, you can now also create an "ext" plugin.
I've attached two samples, the first is "hello-world-ext.zip" which is the project files I used to create "hello-world-ext-5.3.0.1.war".
Use the latest /portal/trunk and /plugins/trunk as of rev 42007.
Unzip hello-world-ext.zip into "/plugins/trunk/ext" to see my project files. I basically created an ext that modified every possible piece of Liferay's core. This is actually more powerful than the old Ext environment because it provides for a standard for updating util-java, util-taglib as well (which didn't exist before).
You can unzip hello-world-ext (to see my project) or go to /plugins/trunk/ext and execute:
create.bat testing-again "Testing Again" to create an extension environemnt called testing-again-ext. (call create.sh in a unix env).
Once you unzip hello-world-ext, you'll see:
hello-world-ext / docroot / WEB-INF
In that folder, you'll see a lot of folders that start with ext-*
ext-impl/src contains code that will override portal-impll/src
ext-lib/global is where you put jars that are avallable in the global class loader
ext-lib/portal is where you put jars that are available only to the portal class loader
ext-service/src contains code that will override portal-kernel/src AND portal-service/src
ext-util-bridges/src contains code that will override util-bridges/src
ext-util-java/src contains code that will override util-java/src
ext-util-taglib/src contains code that will override util-taglib/src
ext-web/docroot contains code that will override portal-web. Note that if you modify ext-web/docroot/WEB-INF/web.xml, those changes are merged into portal-web/WEB-INF/web.xml.
ext-web also contains /WEB-INF/*-ext.xml files that are used to override what is in portal-web.
It works very similarly to the old ext environment, but is now much smaller and lighter weight because the ext env itself did not have to contain the whole portal code, but now only contains the differences / deltas.
When you go to /plugins/trunk/ext/hello-world-ext, you should first run "ant clean"
If you run this task without setting up your environment variables, it'll give you a nice error message that looks like this:
—
Buildfile: build.xml
clean:
BUILD FAILED
L:\projects\liferay.public\plugins\trunk\ext\build-common-ext.xml:19: .
The properties "app.server.dir", "app.server.zip.name", and "ext.work.dir" are
not properly specified.
The directory denoted by the property "ext.work.dir" will be deleted and the zip
file denoted by the property "app.server.zip.name" will be unzipped into this
directory. The property "app.server.dir" must point to the application server
directory that was unzipped into "ext.work.dir".
For example, if "ext.work.dir" points to "C:\ext-work", and
"app.server.zip.name" points to "C:\files\liferay-portal-tomcat-6.0-5.3.0.zip",
then "app.server.dir" should point to
"C:\ext-work\liferay-portal-5.3.0\tomcat-6.0.18".
—
Configure the proper settings and running "ant clean" will take a fresh bundle and unzip it for you. Once 5.3.0 is released, you can just download the bundle. To currently build a bundle, go to /portal/trunk and run "ant all" and then "ant -buildfile build-dist.xml zip-tomcat-6.0" and it'll make the zip file in /portal/dist/liferay-portal-tomcat-6.0-5.3.0.zip
Running "ant compile" in /plugins/ext/hello-world-ext will now compile all the necessary ext code.
Running "ant war" will create /plugins/dist/hello-world-ext-5.3.0.1.war
You can hot deploy this war to a running Liferay bundle. It'l tell you to reboot after the ext plugin has been deployed (since you're changing core classes).
Note that only ONE ext env can be deployed at a time. If you try to deploy more, it won't let you. There really is no need for more than one ext environment.
If you do not want to "hot deploy" your ext env, then go to /plugins/ext/hello-world-ext and run "ant deploy"
It will actually take the bundle that you've unzipped and add all the ext changes directly. Just boot up Tomcat and you're good to go.