Closed DanAngelus closed 7 years ago
Can you share also your dependecies list and configurations ?
Dependencies:
dependencies {
// Fuse
compile(group: 'org.jboss.fuse.bom', name: 'jboss-fuse-parent', version: fuseVersion)
// Camel
compile(group: 'org.apache.camel', name: 'camel-core', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-mybatis', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-ftp', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-jasypt', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-bindy', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-mail', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-cxf', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-jaxb', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.servicemix.bundles', name: 'org.apache.servicemix.bundles.jaxb-impl', version: '2.2.11_1')
// Commons
compile(group: 'org.apache.commons', name: 'commons-lang3', version: '3.1')
compile(group: 'commons-io', name: 'commons-io', version: '2.4')
// CXF
compile(group: 'org.apache.cxf', name: 'cxf-rt-ws-security', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-ws-policy', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-transports-http', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-transports-http-jetty', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-bindings-soap', version: cxfVersion)
// WSS4J
compile(group: 'org.apache.wss4j', name: 'wss4j-ws-security-common', version: wss4jVersion)
}
I tried adding a fuseXml
configuration to include the missing bundles but it didn't add them as dependencies so I removed it:
configurations {
fuseXml
}
dependencies {
fuseXml(group: 'org.apache.servicemix.bundles', name: 'org.apache.servicemix.bundles.spring-jdbc', version: springVersion)
fuseXml(group: 'org.mybatis', name: 'mybatis-spring', version: mybatisVersion)
fuseXml(group: group, name: artifactName, version: version)
.... // Other dependencies as above
}
Note: group
, artifactName
and version
are passed in from the gradle.properties
I think the issue is documentation :)
configuration --> append configurations so it append fuseXml to runtime configurations --> set the configurations to use
So I get you should change from
configuration 'fuseXml'
to
configurations 'fuseXml'
Thanks for your help.
I tried your suggestion and it is now including the missing the entries but they aren't marked as dependencies (it's also still including the other long list of compile time dependencies that I don't really want in my features.xml)
My updated configuration:
karaf {
features {
name = "${artifactName}-features-${version}"
xsdVersion = '1.0.0'
version = "${version}"
includeProject = false
repository("mvn:org.apache.camel.karaf/apache-camel/${camelVersion}/xml/features")
feature {
name = "${artifactName}"
description = "${artifactDescription}"
version = "${version}"
outputFile = new File("${project.buildDir}/libs/features.xml")
configurations 'fuseXml'
feature('camel-blueprint') {
version = camelVersion
}
feature('camel-cxf') {
version = camelVersion
}
feature('camel-mybatis') {
version = camelVersion
}
feature('camel-ftp') {
version = camelVersion
}
feature('camel-jasypt') {
version = camelVersion
}
bundle("mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-jdbc/${springVersion}") // {
// NOTE: I had to comment this out or it threw an exception (below)
// dependency = true
// }
bundle("mvn:org.mybatis/mybatis-spring/${mybatisVersion}") // {
// NOTE: I had to comment this out or it threw an exception (below)
// dependency = true
// }
}
}
}
Exception thrown with dependency = true
is:
Could not set unknown property 'dependency' for object of type com.github.lburgazzoli.gradle.plugin.karaf.features.model.BundleDescriptor.
I will have a look but in the gradle file I see
dependencies {
fuseXml(group: 'org.apache.servicemix.bundles', name: 'org.apache.servicemix.bundles.spring-jdbc', version: springVersion)
fuseXml(group: 'org.mybatis', name: 'mybatis-spring', version: mybatisVersion)
fuseXml(group: group, name: artifactName, version: version)
.... // Other dependencies as above
}
Does that means that fuseXml contains also the runtime/compile dependencies ?
No the other dependencies are all compile
, only those 3 are in the fuseXml
configuration but it seems to be including all of the compile time dependencies as well.
To avoid confusion, here is my build.gradle file:
plugins {
id 'idea'
id 'eclipse'
id 'maven'
id 'groovy'
id 'com.bmuschko.nexus' version '2.3.1'
id 'net.researchgate.release' version '2.5.0'
id 'no.nils.wsdl2java' version '0.10'
id 'com.github.lburgazzoli.karaf' version '0.0.47'
id 'org.dm.bundle' version '0.10.0'
}
apply from: './main.gradle'
apply from: './java.gradle'
apply from: './java_metrics.gradle'
apply from: './maven.gradle'
apply from: './release.gradle'
apply from: './wsdl2java.gradle'
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
// Versions
fuseVersion = '6.2.1.redhat-159'
camelVersion = '2.15.1.redhat-621159'
mybatisVersion = '1.2.5'
cxfVersion = '3.0.4.redhat-621159'
springVersion = '3.2.12.RELEASE_2'
mysqlVersion = '5.1.13'
wss4jVersion = '2.0.3'
}
configurations {
fuseXml
}
dependencies {
// I'd like these to be in the features.xml as dependency bundles (i.e. <bundle dependency="true">...</bundle>)
fuseXml(group: 'org.apache.servicemix.bundles', name: 'org.apache.servicemix.bundles.spring-jdbc', version: springVersion)
fuseXml(group: 'org.mybatis', name: 'mybatis-spring', version: mybatisVersion)
// I'd like this to be in features.xml as a bundle (i.e. <bundle></bundle>)
fuseXml(group: group, name: artifactName, version: version)
// I don't want any of these in the features.xml but they all appear
// Fuse
compile(group: 'org.jboss.fuse.bom', name: 'jboss-fuse-parent', version: fuseVersion)
// Camel
compile(group: 'org.apache.camel', name: 'camel-core', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-mybatis', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-ftp', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-jasypt', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-bindy', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-mail', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-cxf', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.camel', name: 'camel-jaxb', version: camelVersion) {
exclude module: 'com.sun.xml.bind:jaxb-impl'
}
compile(group: 'org.apache.servicemix.bundles', name: 'org.apache.servicemix.bundles.jaxb-impl', version: '2.2.11_1')
// Commons
compile(group: 'org.apache.commons', name: 'commons-lang3', version: '3.1')
compile(group: 'commons-io', name: 'commons-io', version: '2.4')
// CXF
compile(group: 'org.apache.cxf', name: 'cxf-rt-ws-security', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-ws-policy', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-transports-http', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-transports-http-jetty', version: cxfVersion)
compile(group: 'org.apache.cxf', name: 'cxf-rt-bindings-soap', version: cxfVersion)
// WSS4J
compile(group: 'org.apache.wss4j', name: 'wss4j-ws-security-common', version: wss4jVersion)
}
// Custom build script configuration
group "${group}"
version "${version}"
archivesBaseName = "${artifactName}"
jar {
baseName = "${artifactName}"
archiveName = "${artifactName}-${version}.jar"
manifest {
attributes (
'Bundle-Blueprint': 'OSGI-INF/blueprint/blueprint.xml'
)
}
}
bundle {
trace = true
instructions << [
'-plugin': 'aQute.lib.spring.SpringXMLType',
'Import-Package': 'org.eclipse.jetty.server,org.jasypt.encryption.pbe,*'
]
}
karaf {
features {
name = "${artifactName}-features-${version}"
xsdVersion = '1.0.0'
version = "${version}"
includeProject = false
repository("mvn:org.apache.camel.karaf/apache-camel/${camelVersion}/xml/features")
feature {
name = "${artifactName}"
description = "${artifactDescription}"
version = "${version}"
configurations 'fuseXml'
feature('camel-blueprint') {
version = camelVersion
}
feature('camel-cxf') {
version = camelVersion
}
feature('camel-mybatis') {
version = camelVersion
}
feature('camel-ftp') {
version = camelVersion
}
feature('camel-jasypt') {
version = camelVersion
}
bundle("mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-jdbc/${springVersion}")
{
dependency = true
}
bundle("mvn:org.mybatis/mybatis-spring/${mybatisVersion}")
{
dependency = true
}
}
}
}
I will have a look
I've created an example based on your build here: https://github.com/lburgazzoli/gradle-karaf-plugin-examples/tree/master/issue-54 (I've removed some fuse bits)
Running:
gradle clean generateFeatures
It generates:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0" name="my-features-1.1.0">
<repository>mvn:org.apache.camel.karaf/apache-camel/2.19.1/xml/features</repository>
<feature name="my-feature" version="1.1.0" description="my-feature">
<feature version="2.19.1">camel-blueprint</feature>
<feature version="2.19.1">camel-cxf</feature>
<feature version="2.19.1">camel-mybatis</feature>
<feature version="2.19.1">camel-ftp</feature>
<feature version="2.19.1">camel-jasypt</feature>
<bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-jdbc/3.2.12.RELEASE_2</bundle>
<bundle dependency="true">mvn:org.mybatis/mybatis-spring/1.2.5</bundle>
<bundle>mvn:com.github.lburgazzoli/issue-54/1.1.0</bundle>
</feature>
</features>
Which I think is closed to what you'd expect, correct ?
That is exactly what I'm looking for.
I will copy your configuration into my own and let you know the result.
btw, you should also run the clean task as sometimes it fails to catch up with the changes.
That's solved it! I realise now where I was going wrong so I can go ahead and add this plugin to my other Fuse projects.
Thank you very much for your quick help, it's much appreciated.
Btw there is also a gitter room if needed https://gitter.im/lburgazzoli/gradle-karaf-plugin
Hi,
I've been migrating a project over to Gradle and attempting to use your plugin to generate the features.xml but I seem to get a lot of "extra" information in there than I really need and I can't seem to add any bundles as dependencies.
Here is my configuration:
I've attached the actual output and the output that I'd like to achieve, are you able to help or am I attempting something that is currently not supported?
Thanks, Dan
features.xml - This is what I get after generation features.xml - This is what I would like to generate