aboutsummaryrefslogtreecommitdiffstats
path: root/demo_gradle/app
diff options
context:
space:
mode:
authorCesar Andres <cesar.vera-bernal@lucidworks.com>2017-10-21 15:52:17 -0500
committerDecebal Suiu <decebal.suiu@gmail.com>2017-10-21 23:52:17 +0300
commit468abf3490028bbce5cf748d76cc22b73dab2d15 (patch)
tree47c6695bf579388858c789f7d71741247bf4cc18 /demo_gradle/app
parent42aaee15591e241add08323c76f4f813867f996b (diff)
downloadpf4j-468abf3490028bbce5cf748d76cc22b73dab2d15.tar.gz
pf4j-468abf3490028bbce5cf748d76cc22b73dab2d15.zip
ISSUE-169: fix gradle demo (#177)
Diffstat (limited to 'demo_gradle/app')
-rw-r--r--demo_gradle/app/build.gradle31
-rw-r--r--demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java14
2 files changed, 36 insertions, 9 deletions
diff --git a/demo_gradle/app/build.gradle b/demo_gradle/app/build.gradle
index 9f3d5a4..4761092 100644
--- a/demo_gradle/app/build.gradle
+++ b/demo_gradle/app/build.gradle
@@ -3,14 +3,29 @@ apply plugin: 'application'
mainClassName = 'org.pf4j.demo.Boot'
dependencies {
- compile project(':api')
- compile 'org.pf4j:pf4j:2.0.0-SNAPSHOT'
- compile 'org.apache.commons:commons-lang3:3.5'
- testCompile group: 'junit', name: 'junit', version: '4.+'
- compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
+ compile project(':api')
+ compile group: 'org.pf4j', name: 'pf4j', version: "${pf4jVersion}"
+ compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
+ compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
+
+ testCompile group: 'junit', name: 'junit', version: '4.+'
}
-jar {
- baseName = 'Plugin Demo'
- version = '0.1.0'
+task uberjar(type: Jar, dependsOn: ['compileJava']) {
+ zip64 true
+ from configurations.runtime.asFileTree.files.collect {
+ exclude "META-INF/*.SF"
+ exclude "META-INF/*.DSA"
+ exclude "META-INF/*.RSA"
+ zipTree(it)
+ }
+ from files(sourceSets.main.output.classesDir)
+ from files(sourceSets.main.resources)
+ manifest {
+ attributes 'Main-Class': mainClassName
+ }
+
+ baseName = "${project.name}-plugin-demo"
+ classifier = "uberjar"
}
+
diff --git a/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java b/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java
index 46261d6..9343f4a 100644
--- a/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java
+++ b/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java
@@ -16,6 +16,9 @@
package org.pf4j.demo;
import org.apache.commons.lang3.StringUtils;
+import org.pf4j.CompoundPluginDescriptorFinder;
+import org.pf4j.ManifestPluginDescriptorFinder;
+import org.pf4j.PropertiesPluginDescriptorFinder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.pf4j.DefaultPluginManager;
@@ -38,7 +41,16 @@ public class Boot {
printLogo();
// create the plugin manager
- final PluginManager pluginManager = new DefaultPluginManager();
+ final PluginManager pluginManager = new DefaultPluginManager() {
+ @Override
+ protected CompoundPluginDescriptorFinder createPluginDescriptorFinder() {
+ return new CompoundPluginDescriptorFinder()
+ // Demo is using the Manifest file
+ // PropertiesPluginDescriptorFinder is commented out just to avoid error log
+ //.add(new PropertiesPluginDescriptorFinder())
+ .add(new ManifestPluginDescriptorFinder());
+ }
+ };
// load the plugins
pluginManager.loadPlugins();