The Gradle IPojo Plugin IPojoizes your jars, making it really easy to benefit from IPojo in any Gradle project.
Add to your build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.athaydes.gradle.osgi:ipojo-plugin:1.0"
}
}
apply plugin: 'ipojo'Now, when the jar task runs, the IPojo Plugin will add IPojo metadata to the jars automatically.
Gradle 2.0+ is required to use this plugin (due to the asm-all dependency, which is shared with Gradle)
IPojo annotations and XML configuration are supported.
If you do not want the plugin to overwrite your common jar,
you may set the ipojo.outDir property to let the IPojo plugin
know where it should save your ipojoized bundle:
build.gradle
ipojo {
outDir = 'your-ipojo-directory/location'
}If set to true, the IPojo manipulator skips annotations processing (can reduce significantly the processing time on large bundles).
build.gradle
ipojo {
ignoreAnnotations = true
}If set to true, the IPojo manipulator will not look at remote XSD resources to validate metadata.
build.gradle
ipojo {
useLocalXSD = true
}The location of the XML metadata file.
If not set, the IPojo plugin will look inside the bundle, in the following locations (the first existing one will be used):
- metadata.xml
- META-INF/metadata.xml
This property can be set using the following types:
String: path to the metadata file (relative to the project root).File: location of the metadata file.Iterable<String | File>: the first existing path will be used.
Examples:
- Use the file called
ipojo.xmllocated at the project root folder.
ipojo {
metadata = 'ipojo.xml'
}- Try to use
config/metadata.xml(using Gradle'sfilemethod). If it does not exist, useWEB-INF/metadata.xml.
ipojo {
metadata = [file('config/metadata.xml'), 'WEB-INF/metadata.xml']
}If set to true, the build will fail if no IPojo components have been detected in the input bundle. If not set (or set to false), only a INFO-level message will be displayed.
This option is useful if you want to ensure your metadata has been used as expected, but notice that many API bundles can be used with IPojo without any metadata at all.
build.gradle
ipojo {
failIfNoIPojoComponents = true
}The IPojo Plugin applies the following plugins:
Use the Osgi-run Plugin to create an OSGi environment and automatically install and start all your bundles, including the IPojo bundles.
See the ipojo-example, which contains the code shown on the IPojo Maven Tutorial.