To show how shared plugin is useful lets just mention that liferay-plugin-package.properties already supports some widely used dependency declarations:
- dependency to Liferay Portal jars can be declared using
portal-dependency-jars- during compile phase it will use portal-dependency.jar but it will be excluded from created archiveportal-dependency-tlds
- dependency to other plugins auto-generated *-service.jar entry you declare using:
required-deployment-contexts- during compile phase it will fetch required-deployment-context-service.jar and include it in created archive
Why shared plugin?
- Once you're inside your SDK go to shared folder and create structure for your new plugin:
mkdir batman-shared
cd to batman-shared
- Create ant build file (you can copy an existing from other plugin):
vim build.xml
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="batman-shared" basedir="." default="deploy">
<property name="plugin.version" value="1" />
<import file="../build-common-shared.xml" />
</project>
- Configure project files
mkdir src
mkdir lib (this is optional if your code doesn't need any additional jar file)
ant setup-eclipse
- Put your packages and classes into src folder
ant jar
How to refer shared plugin from other plugin?
build.xml with new line:
<property name="import.shared" value="batman-shared" />
<property name="import.shared" value="batman-shared,robin-shared" />

