Closed eschizoid closed 8 years ago
Do you mean to generate a feature with properties or start from a feature xml file with properties ?
The second one, start from a feature.xml
file that pulls the properties from a gradle.properties
file.
The problem is that this plugin does not read an arbitrary features file to generate a kar but instead is uses project dependencies (same as features file generation) so as long as you have defined your dependencies in grade and potentially versions in gradle.properties you should be fine.
Generating a kar from an arbitrary file might be added later on, but not my highest priority for the moment.
@lburgazzoli The problem is that the feature file that we are using has a lot of customization. For instance, I have some jar files that need to be wrap since are not OSGi ready.
<feature name="sql-server"
description="Microsoft SQL Server Driver"
version="${sql.version}">
<!-- as if Microsoft cared about OSGi... -->
<bundle dependency="true">wrap:mvn:com.microsoft/sql-jdbc/${sql.version}</bundle>
</feature>
And some custom features:
<feature name="camel-cache" version="${camel.version}">
<feature version="[1.1,2)">transaction</feature>
<feature version="[2.10,3)">ehcache</feature>
<bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jdom/1.1_4</bundle>
<bundle dependency="true">mvn:org.apache.camel/camel-cache/${camel.version}</bundle>
</feature>
I don't think the KAR task is going to be able to add all this instructions if it only scans the dependencies.
It is, if the jar do not have an osgi-fied meta-inf it add wrap to the feature, but you can also force wrapping
Great! And what about the custom features?
Can. you give an example?
<feature name="jpa" description="OSGi Persistence Container" version="2.1.0">
<details>JPA implementation provided by Apache Aries JPA 1.0.2.</details>
<feature version="[1.1,2)">transaction</feature>
<bundle dependency="true" start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
<bundle dependency="true" start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.1.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.2</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.2</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.4</bundle>
<conditional>
<condition>aries-blueprint</condition>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.4</bundle>
</conditional>
</feature>
so here you are referring to:
correct ?
That is correct.
@lburgazzoli Any update regarding to this?
Not yet implemented, hope I have some time next week
On Wednesday, 6 January 2016, Mariano Gonzalez notifications@github.com wrote:
@lburgazzoli https://github.com/lburgazzoli Any update regarding to this?
— Reply to this email directly or view it on GitHub https://github.com/lburgazzoli/gradle-karaf-features-plugin/issues/23#issuecomment-169180644 .
Hi, I'm re-factoring the plugin to support more Karaf functionalities and the first cut can be found in Gradle Plugin portal .
It only support karaf features files at the moment so with a configuration like:
plugins {
id 'java'
id 'groovy'
id 'maven'
id "com.github.lburgazzoli.karaf" version "0.0.9"
}
group = 'com.lburgazzoli.github'
version = '1.2.3'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile "com.google.guava:guava:19.0"
compile "com.squareup.retrofit:retrofit:1.9.0"
compile 'com.fasterxml.jackson.core:jackson-core:2.7.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.0'
}
karaf {
features {
xsdVersion = "1.3.0"
feature {
name = "karaf-features-example"
description = "feature-description"
details = "my detailed description"
includeProject = false
conditional {
condition = 'json-p'
feature 'myfeature-1'
feature 'myfeature-2'
bundle 'com.fasterxml.jackson.core'
}
}
}
}
It will generates the following xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="example">
<feature name="karaf-features-example" version="1.2.3" description="feature-description">
<details>my detailed description</details>
<bundle>mvn:com.google.guava/guava/19.0</bundle>
<bundle>mvn:com.google.code.gson/gson/2.3.1</bundle>
<bundle>wrap:mvn:com.squareup.retrofit/retrofit/1.9.0</bundle>
<conditional>
<condition>json-p</condition>
<feature>myfeature-1</feature>
<feature>myfeature-2</feature>
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.7.0</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.7.0</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.7.0</bundle>
</conditional>
</feature>
</features>
@lburgazzoli These are great news man! Thank you!
@lburgazzoli Don't forget the repository element :wink:
<repository>mvn:org.apache.karaf.cellar/apache-karaf-cellar/${cellar.version}/xml/features</repository>
<repository>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</repository>
<repository>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</repository>
<repository>mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features</repository>
<repository>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</repository>
<repository>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</repository>
Hey @lburgazzoli have you done any progress related to this?
Not for the moment, hope get back working on this next week
I've just relased a new gradle-karaf-plugin 0.0.10 on gradle plugin central, can you havea look ? If any issue an you report them to gradle-karaf-plugin
@lburgazzoli You have any documentation how to use it?
@lburgazzoli Testing it right now.
generateFeatures
task is working pretty well. However, I don't see any task to generate a kar
archive.
@eschizoid yes it is still missing, I will add it soon
Does this support resource property filtering like the maven plugins?
@jvz can you post an example ?
@eschizoid had a good example actually (except I don't think you can use periods in gradle properties):
<repository>mvn:org.apache.karaf.features/standard/${karafVersion}/xml/features</repository>
Where karafVersion
is defined in gradle.properties
or specified by the -P
option. When I specify a property like that in maven, karaf-maven-plugin
does the same thing as maven-resources-plugin
by filtering its files with property placeholders specified through either ${thisSyntax}
or @thisSyntax@
.
This is when you tell maven-karaf-plugin to generate a kar based on a pre-existing features file correct ?
Yeah. I originally used a custom features file because the maven plugin was generating dependencies out of order which was causing Karaf to barf. Now it's legacy even if the plugin generates dependencies in the right order (plus I like to reuse feature repositories like camel's).
@jvz I may add support for external features definition but not in the initial phase, can you log a ticket on gradle-karaf-plugin ?
Sure.
@lburgazzoli shall we close this ticket? and probably link it to the one @jvz created?
yes please
Closing in favor of this one:
Currently, the
karaf-maven-plugin
for creating a kar file can resolve the version number from a<prooperties>
tag, for instance:Maven
pom.xml
That way you can define a
feature.xml
file like the followingIt would be ideal if the same behavior can be accomplished using a
gradle.properties
file.