Browse Source

put all demo plugins in folder demo/plugins

pull/3/head
Decebal Suiu 11 years ago
parent
commit
5cb10a465e
  1. 5
      demo/plugin1/plugin.properties
  2. 131
      demo/plugin1/pom.xml
  3. 37
      demo/plugin1/src/main/assembly/assembly.xml
  4. 46
      demo/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java
  5. 0
      demo/plugins/plugin2/plugin.properties
  6. 2
      demo/plugins/plugin2/pom.xml
  7. 0
      demo/plugins/plugin2/src/main/assembly/assembly.xml
  8. 0
      demo/plugins/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java
  9. 37
      demo/plugins/pom.xml
  10. 3
      demo/pom.xml
  11. 4
      run-demo.bat
  12. 4
      run-demo.sh

5
demo/plugin1/plugin.properties

@ -1,5 +0,0 @@
plugin.id=welcome-plugin
plugin.class=ro.fortsoft.pf4j.demo.welcome.WelcomePlugin
plugin.version=0.0.1
plugin.provider=Decebal Suiu
plugin.dependencies=

131
demo/plugin1/pom.xml

@ -1,131 +0,0 @@
<?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-parent</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>

37
demo/plugin1/src/main/assembly/assembly.xml

@ -1,37 +0,0 @@
<!--
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>

46
demo/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java

@ -1,46 +0,0 @@
/*
* 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";
}
}
}

0
demo/plugin2/plugin.properties → demo/plugins/plugin2/plugin.properties

2
demo/plugin2/pom.xml → demo/plugins/plugin2/pom.xml

@ -3,7 +3,7 @@
<parent>
<groupId>ro.fortsoft.pf4j.demo</groupId>
<artifactId>pf4j-demo-parent</artifactId>
<artifactId>pf4j-demo-plugins</artifactId>
<version>0.5-SNAPSHOT</version>
</parent>

0
demo/plugin2/src/main/assembly/assembly.xml → demo/plugins/plugin2/src/main/assembly/assembly.xml

0
demo/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java → demo/plugins/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java

37
demo/plugins/pom.xml

@ -0,0 +1,37 @@
<?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-parent</artifactId>
<version>0.5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>ro.fortsoft.pf4j.demo</groupId>
<artifactId>pf4j-demo-plugins</artifactId>
<version>0.5-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Demo Plugins Parent</name>
<build>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
<modules>
<module>plugin1</module>
<module>plugin2</module>
</modules>
</project>

3
demo/pom.xml

@ -32,8 +32,7 @@
<modules>
<module>app</module>
<module>api</module>
<module>plugin1</module>
<module>plugin2</module>
<module>plugins</module>
</modules>
</project>

4
run-demo.bat

@ -12,8 +12,8 @@ mkdir demo-dist\plugins
REM copy artifacts to demo-dist folder
xcopy demo\app\target\pf4j-demo-app-*.zip demo-dist /s /i
xcopy demo\plugin1\target\pf4j-demo-plugin1-*.zip demo-dist\plugins /s
xcopy demo\plugin2\target\pf4j-demo-plugin2-*.zip demo-dist\plugins /s
xcopy demo\plugins\plugin1\target\pf4j-demo-plugin1-*.zip demo-dist\plugins /s
xcopy demo\plugins\plugin2\target\pf4j-demo-plugin2-*.zip demo-dist\plugins /s
cd demo-dist

4
run-demo.sh

@ -14,8 +14,8 @@ mkdir demo-dist/plugins
# copy artifacts to demo-dist folder
cp -r demo/app/target/pf4j-demo-*/* demo-dist/
cp demo/plugin1/target/pf4j-demo-plugin1-*.zip demo-dist/plugins/
cp demo/plugin2/target/pf4j-demo-plugin2-*.zip demo-dist/plugins/
cp demo/plugins/plugin1/target/pf4j-demo-plugin1-*.zip demo-dist/plugins/
cp demo/plugins/plugin2/target/pf4j-demo-plugin2-*.zip demo-dist/plugins/
# run demo
cd demo-dist

Loading…
Cancel
Save