]> source.dussan.org Git - pf4j.git/commitdiff
add missing files after refactoring plugins location
authorDecebal Suiu <decebal.suiu@gmail.com>
Wed, 25 Sep 2013 13:56:52 +0000 (16:56 +0300)
committerDecebal Suiu <decebal.suiu@gmail.com>
Wed, 25 Sep 2013 13:56:52 +0000 (16:56 +0300)
demo/plugins/plugin1/plugin.properties [new file with mode: 0644]
demo/plugins/plugin1/pom.xml [new file with mode: 0644]
demo/plugins/plugin1/src/main/assembly/assembly.xml [new file with mode: 0644]
demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java [new file with mode: 0644]

diff --git a/demo/plugins/plugin1/plugin.properties b/demo/plugins/plugin1/plugin.properties
new file mode 100644 (file)
index 0000000..4f95d99
--- /dev/null
@@ -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 (file)
index 0000000..5880fb9
--- /dev/null
@@ -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 (file)
index 0000000..3fdc464
--- /dev/null
@@ -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 (file)
index 0000000..d10d3dd
--- /dev/null
@@ -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";
+        }
+
+    }
+
+}