diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2013-09-25 16:56:52 +0300 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2013-09-25 16:56:52 +0300 |
commit | 00acfeba25fd413c7510ba882a3a24d4c2a0b2af (patch) | |
tree | 18e26cf863f216fc6699efac0a2b97b7090640ac | |
parent | 5cb10a465ebf83e44c6f5009d5e59a66327a154e (diff) | |
download | pf4j-00acfeba25fd413c7510ba882a3a24d4c2a0b2af.tar.gz pf4j-00acfeba25fd413c7510ba882a3a24d4c2a0b2af.zip |
add missing files after refactoring plugins location
-rw-r--r-- | demo/plugins/plugin1/plugin.properties | 5 | ||||
-rw-r--r-- | demo/plugins/plugin1/pom.xml | 131 | ||||
-rw-r--r-- | demo/plugins/plugin1/src/main/assembly/assembly.xml | 37 | ||||
-rw-r--r-- | demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java | 46 |
4 files changed, 219 insertions, 0 deletions
diff --git a/demo/plugins/plugin1/plugin.properties b/demo/plugins/plugin1/plugin.properties new file mode 100644 index 0000000..4f95d99 --- /dev/null +++ b/demo/plugins/plugin1/plugin.properties @@ -0,0 +1,5 @@ +plugin.id=welcome-plugin +plugin.class=ro.fortsoft.pf4j.demo.welcome.WelcomePlugin +plugin.version=0.0.1 +plugin.provider=Decebal Suiu +plugin.dependencies= diff --git a/demo/plugins/plugin1/pom.xml b/demo/plugins/plugin1/pom.xml new file mode 100644 index 0000000..5880fb9 --- /dev/null +++ b/demo/plugins/plugin1/pom.xml @@ -0,0 +1,131 @@ +<?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/xsd/maven-4.0.0.xsd"> + + <parent> + <groupId>ro.fortsoft.pf4j.demo</groupId> + <artifactId>pf4j-demo-plugins</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <artifactId>pf4j-demo-plugin1</artifactId> + <version>0.5-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Demo Plugin #1</name> + + <properties> + <plugin.id>welcome-plugin</plugin.id> + <plugin.class>ro.fortsoft.pf4j.demo.welcome.WelcomePlugin</plugin.class> + <plugin.version>0.0.1</plugin.version> + <plugin.provider>Decebal Suiu</plugin.provider> + <plugin.dependencies /> + </properties> + + <build> + <plugins> + <!-- DOESN'T WORK WITH MAVEN 3 (I defined the plugin metadata in properties section) + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>properties-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <phase>initialize</phase> + <goals> + <goal>read-project-properties</goal> + </goals> + <configuration> + <files> + <file>plugin.properties</file> + </files> + </configuration> + </execution> + </executions> + </plugin> + --> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.6</version> + <executions> + <execution> + <id>unzip jar file</id> + <phase>package</phase> + <configuration> + <target> + <unzip src="target/${artifactId}-${version}.${packaging}" dest="target/plugin-classes" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.3</version> + <configuration> + <descriptors> + <descriptor> + src/main/assembly/assembly.xml + </descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>attached</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.4</version> + <configuration> + <archive> + <manifestEntries> + <Plugin-Id>${plugin.id}</Plugin-Id> + <Plugin-Class>${plugin.class}</Plugin-Class> + <Plugin-Version>${plugin.version}</Plugin-Version> + <Plugin-Provider>${plugin.provider}</Plugin-Provider> + <Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies> + </manifestEntries> + </archive> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>ro.fortsoft.pf4j</groupId> + <artifactId>pf4j</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>ro.fortsoft.pf4j.demo</groupId> + <artifactId>pf4j-demo-api</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + +</project> diff --git a/demo/plugins/plugin1/src/main/assembly/assembly.xml b/demo/plugins/plugin1/src/main/assembly/assembly.xml new file mode 100644 index 0000000..3fdc464 --- /dev/null +++ b/demo/plugins/plugin1/src/main/assembly/assembly.xml @@ -0,0 +1,37 @@ +<!-- + Describes the plugin archive + + @author Decebal Suiu + @version 1.0 +--> +<assembly> + <id>plugin</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <scope>runtime</scope> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*:jar:*</include> + </includes> + </dependencySet> + </dependencySets> + <!-- + <fileSets> + <fileSet> + <directory>target/classes</directory> + <outputDirectory>classes</outputDirectory> + </fileSet> + </fileSets> + --> + <fileSets> + <fileSet> + <directory>target/plugin-classes</directory> + <outputDirectory>classes</outputDirectory> + </fileSet> + </fileSets> +</assembly> diff --git a/demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java b/demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java new file mode 100644 index 0000000..d10d3dd --- /dev/null +++ b/demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java @@ -0,0 +1,46 @@ +/* + * Copyright 2012 Decebal Suiu + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with + * the License. You may obtain a copy of the License in the LICENSE file, or at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package ro.fortsoft.pf4j.demo.welcome; + +import ro.fortsoft.pf4j.Extension; +import ro.fortsoft.pf4j.Plugin; +import ro.fortsoft.pf4j.PluginWrapper; +import ro.fortsoft.pf4j.demo.api.Greeting; + +/** + * @author Decebal Suiu + */ +public class WelcomePlugin extends Plugin { + + public WelcomePlugin(PluginWrapper wrapper) { + super(wrapper); + } + + public void start() { + System.out.println("WelcomePlugin.start()"); + } + + public void stop() { + System.out.println("WelcomePlugin.stop()"); + } + + @Extension + public static class WelcomeGreeting implements Greeting { + + public String getGreeting() { + return "Welcome"; + } + + } + +} |