lburgazzoli / gradle-karaf-features-plugin

Apache License 2.0
4 stars 13 forks source link

Fix project adding to feature #20

Closed SOVALINUX closed 8 years ago

SOVALINUX commented 8 years ago

Quite critical bug for me, could you please make a release after that?

lburgazzoli commented 8 years ago

Hi, the release was not intended sorry for that, I'm testing release to gradle's plugin portal.

I've changed the behavior of getProjectDescriptors because the plugin does not work anymore for very simple projects, like:

buildscript {
  repositories {
    mavenLocal()
  }
  dependencies {
    classpath "com.github.lburgazzoli:gradle-karaf-features-plugin:2.9.6-SNAPSHOT"
  }
}

apply plugin: "java"
apply plugin: "maven"
apply plugin: "com.github.lburgazzoli.karaf.features"

group               = 'com.github.lburgazzoli'
version             = '1.0.0'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
}

dependencies {
    compile("org.slf4j:slf4j-api:1.7.13") { transitive = false }
    compile("org.slf4j:slf4j-ext:1.7.13") { transitive = false }
}

karafFeatures {
    name       = project.name
    xsdVersion = '1.3.0'
    outputFile = null

    repository 'mvn:group/dependent-feature/1.2.3/xml/features'
    repository 'mvn:group/artifact/1.1.1/xml/features'

    features {
        'main' {
            description = 'Main feature'
        }
    }
}

The features resulting is the one below which is wrong as it does not include any dependence declared in the project:

<features xmlns='http://karaf.apache.org/xmlns/features/v1.3.0' name='gradle-karaf-features-plugin-examples'>
  <repository>mvn:group/dependent-feature/1.2.3/xml/features</repository>
  <repository>mvn:group/artifact/1.1.1/xml/features</repository>
  <feature name='main' version='1.0.0' description='Main feature' />
</features>

But then I've noticed that it breaks your tests. I've amended "Simple project" so that it fails (before it was an useful test), @SOVALINUX can you have a look ?

lburgazzoli commented 8 years ago

I've partially fixed it via 364aa3bd6afa37f66a5e01791338dc1bb548df5e, can you check if it break any of your requirements ?

The outstanding problem now is the following one:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="gradle-karaf-features-plugin">
    <feature name="gradle-karaf-features-plugin" description="gradle-karaf-features-plugin" version="1.0.0.SNAPSHOT">
        <bundle>mvn:org.apache.camel/camel-core/2.16.1</bundle>
        <bundle>mvn:com.sun.xml.bind/jaxb-core/2.2.11</bundle>
        <bundle>mvn:com.sun.xml.bind/jaxb-impl/2.2.11</bundle>
        <bundle>mvn:org.slf4j/slf4j-api/1.7.11</bundle>
        <bundle>mvn:org.slf4j/slf4j-simple/1.7.11</bundle>
    </feature>
</features>
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<features xmlns='http://karaf.apache.org/xmlns/features/v1.3.0' name='gradle-karaf-features-plugin-examples'>
  <feature name='main' version='1.0.0' description='gradle-karaf-features-plugin-examples'>
    <bundle>mvn:org.slf4j/slf4j-api/1.7.13</bundle>
    <bundle>mvn:org.slf4j/slf4j-simple/1.7.13</bundle>
    <bundle>mvn:com.sun.xml.bind/jaxb-core/2.2.11</bundle>
    <bundle>mvn:com.sun.xml.bind/jaxb-impl/2.2.11</bundle>
    <bundle>mvn:org.apache.camel/camel-core/2.16.1</bundle>
    <bundle>wrap:mvn:com.github.lburgazzoli/gradle-karaf-features-plugin-examples/1.0.0</bundle>
  </feature>
</features>

So the gradle one adds the root project bundle.

SOVALINUX commented 8 years ago

Hi, released version 2.9.6 works fine for me. Quite weird example above for me. I'm right that project doesn't have any target jar file, so we shouldn't add it as a bundle? Looks like we need to add some check about generated artifact in project.

lburgazzoli commented 8 years ago

I think we are fine :-) maven need to be instructed to include the project bundle as it is supposed to be used in a separate subproject